Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
191 views48 pages

Questions 1

The document discusses various concepts in COBOL programming including: 1) The four divisions of a COBOL program: identification, environment, data, and procedure. 2) Common data types like fixed-length and variable-length records, tables, indexes, and how to define them. 3) Control structures like IF statements, PERFORM, and SEARCH to process data. 4) File handling concepts involving OPEN, READ, WRITE, CLOSE and the use of input/output buffers. 5) Numeric data types like COMP, COMP-1, COMP-2, COMP-3 and how numbers are stored.

Uploaded by

sati1987
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
191 views48 pages

Questions 1

The document discusses various concepts in COBOL programming including: 1) The four divisions of a COBOL program: identification, environment, data, and procedure. 2) Common data types like fixed-length and variable-length records, tables, indexes, and how to define them. 3) Control structures like IF statements, PERFORM, and SEARCH to process data. 4) File handling concepts involving OPEN, READ, WRITE, CLOSE and the use of input/output buffers. 5) Numeric data types like COMP, COMP-1, COMP-2, COMP-3 and how numbers are stored.

Uploaded by

sati1987
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

R.

Ramakrishna

COBOL
What is a System Flowchart? System Flowchart consists of the programs and input/output files processed by those programs. There are 4 divisions in COBOL: I. IDENTIFICATION - Identifies the program to a computer and provides documentation. II. ENVIRONMENT - Introduces to all files to be used in this program and links internal file to the JCL. III. DATA - Describes both internal and external data and consists of 6 sections: 1. FILE - Defines input and output files (external data). 2. WORKING-STORAGE - Reserves memory (storage) for fields that are not part of an I/O, but are requires processing, it describe internal data to a program. 3. LINKAGE - Permits communications between Main program and a few Subprogram. IV. PROCEDURE - Consists of the instructions (commands) needed to convert input into desirable output. What does an asterisk (*) in column 7 mean? Comments. Compiler ignores this line. What is a compiler? Compiler has 3 functions: 1. To copy members from copy library to your program. 2. To check for syntactic errors. 3. To translate COBOL code (Source module) into machine (Object module). What is a LABEL RECORDS option? LABEL RECORD STANDARD means that disk or tape file has two first records of 80 bytes with information about this file such as: file name, logical record length, blocksize, creation and expiration data. LABEL RECORD OMITTED is a default and may be used for card files or reports. Use STANDARD option always. System automatically ignores it for cards and reports. F is fixed; all records are the same lengths. V is variable; records may have different length. first 4 bytes. How can you describe variable records? 1. Could have a few 01 levels in one FD. 2. May use a DEPENDING ON option. 3. May redefine records in WORKING-STORAGE area. How can you define a Variable length table? Variable length table should contain OCCURS DEPENDING ON clause. Why would you use BLOCK CONTAIN 0 RECORDS? For greater efficiency. If blocksize has to be changed, we would change it in JCL only therefore we wont have to alter COBOL program. We must use this option because the default is 1 record, which is the most inefficient. A 01 level is a major level; it is used for a record names. A 77 level used for an elementary data item, which is not part of a record, used for counters, switches and flags in W-S and must be coded before 01 level. Any 01 level field description can potentially increase the size of the WORKING-STORAGE, because each 01 level field description should be positioned at Double-Word boundary and system might have to insert slack (loose) byte to accomplish that. By using 01 or 77 levels we decrease computer speed because computer has to establish an address each time it sees 01 or 77 level. Solution: create a group field under 01 level and then use sublevels. Levels 02 - 49 are sublevels for a record or field, starting in column 8 or beyond. Level 88 is condition name; it assigns values to names for future comparisons. You can use VALUE clause only with 88 level, to set a value to a field, which could be tested.

The system recognizes the length by the

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna Group item is a field that further subdivided and does not have a PIC clause. Elementary item is a non-subdivided field and has a PIC clause. Reserved word in COBOL is a word that has special meaning to a compiler (MOVE, ADD). Figurative constants could be Alphanumeric - SPACE(s), LOW-VALUE(s), HIGH-VALUE(s), ALL, , and Numeric - ZERO(s), ZEROES. Special registers are WHEN COMPILE, RETURN-CODE, SORT-RETURN-CODE, TALLY and INDEX. What types of numeric data do you know? DISPLAY, COMP, COMP-1, COMP-2, COMP-3. Numeric DISPLAY or Zoned decimal is used to be printed on a report and to store data on a file (PIC 9). COMP is BINARY, PIC S9(01) to PIC S9(05) to PIC S9(10) to computer uses PIC S9(04) PIC S9(09) PIC S9(18) binary. 2 bytes (Halfword). 4 bytes (Fullword). 8 bytes (Doubleword).

COMP-3 is Packed Decimal, and it used calculate amount of bytes in a field. ODD - (ODD + 1) / 2 EVEN - EVEN / 2 + 1 IBM computers understand not only BINARY, but COMP-3 as well. In IBM computers all arithmetic operations are done in COMP-3, if you defined a numeric field as COMP-3 in advance, you will save time by not converting other numeric data to COMP-3. In addition you will save half space by storing data in COMP-3. In EBCDIC, how would the number 1234 be stored? F1F2F3F4. In Packed Decimal number +1234, how would be stored? 01234F The purpose of Synchronized Clause (SYNC) is to assign COMP fields on the appropriate boundary in order to make internal arithmetic operations more efficient. When would you use REDEFINEs? 1. To describe Numeric field as Alphanumeric or vise versa. 2. To describe different record layouts in the same area. 3. To set a Hardcoded table (each entry has a value, we dont load this table it was loaded from a record). Restriction and rule is: The largest record or field must be defining first. Carriage-control is 1 character field that controls spacing in a report. What is a Table? A Table (array) is a group of OCCURS clause. A table could II). If you want to describe OCCURS. In order to access a

elements in have from 1 for example table entry

1 or more dimensions. We recognize table by to 3 dimensions (in COBOL) and up to 7 (in COBOL 3 dimensional table you have to use 3 levels of you need a Subscript (SUB) or an INDEX.

Is it possible for an individual element of a table to have an initial value? No, because OCCURS clause cannot work with VALUE clause. How many different ways can the table be search? 1. Using PERFORM VARYING. 2. Sequential Search (SEARCH). 3. Binary Search (SEARCH ALL). Subscript (SUB) is internal counter that must be defined in W-S SECTION as COMP, because conversion to BINARY is done before accessing a table. SUB contains the occurrence number, which must be used to calculate the displacement from the beginning of a table. We assign values like ADD, SUBTRACT, MOVE and PERFORM VARYING for a Subscript. INDEX is Special Register, which contains the displacement form the beginning of a table . A pointer to a table entry. It increases the speed because you save on instructions. We assign values like SET IX UP BY 1, SET IX DOWN BY 2, SET IX TO 3, PERFORM VARYING, and SEARCH, for a INDEX.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna SEARCH (Sequential search) - It starts at the beginning of a table and checks each entry one by one. SEARCH ALL (Binary search) - It starts in the middle of a table and splits it in half up or down until match is found. To use SEARCH ALL table must have a key in ASCENDING or DESCENDING order. Binary search is much faster then Sequential. How to terminate SEARCH? Use WHEN statement. What is a Relative INDEX? IX + 2 gives the ability pointing to a few table entries in the same time. Can you INITIALIZE Index to 0? No Name PERFORMs? 1. PERFORM. 2. PERFORM THRU. 3. PERFORM TIMES. 4. PERFORM UNTIL. 5. PERFORM VARYING. 6. Nested PERFORM (AFTER). 7. In-line PERFORM. IF statement used to check if condition true or false also its used for comparison. , Nested IF statement is an IF statement within another IF statement. Rules are: 1. Each statement within Nested IF statement is controlled by the previously written IF or ELSE. 2. Each ELSE in the Nested IF statement corresponds to the nearest IF which does not yet have ELSE. 3. Numbers of IFs must be equal to numbers of ELSEs. What is a VTOC? Visual Table Of Contents. Has Hierarchical Structure and represents Top-Down design. one entry point and one exit point.

Has

What are advantages of Structured programming? The following advantages: a. The program gets rid of GO TO statements and is represented by Top-Down structure, which is visible and easy to understand. b. If the program is complicated, team of people can work on different parts of the program. c. Because the program has a specific (hierarchical) structure, it is easy to write a program and to debug that program. GO TO completely changes directions, transfer control to routine. PERFORM executes a routine and return back to the next statement after the PERFORM. What are the advantages and disadvantages to have record description in the WORKING STORAGE rather than in FDs? It provides you such conveniences as: a. Easy to read dump - address in W-S easy to find. b. You have a access to W-S before opening files. c. To initialize fields in advance. d. The information is still available after write. But disadvantages are: a. Program needs larger region. b. When you selecting a few records from file, you do extra MOVE from input buffer to W-S. In these cases, keep record in input buffer. What is ON SIZE ERROR? If this option is used and an error occurred in arithmetic operations, you specify what should be done. DIVISION BY ZERO without this option will cause an ABEND and overflow of a field would not be detected, without this option. What is the basic logic behind Merge program?

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna The Merge program compares the key of both files and processes the file whose key value is less. (To process a file in this case meant: to write a merged file from that file and to read that file). OPEN statement makes files available to the system, check labels for input files and creates labels for output. OPEN INPUT... OUTPUT checks labels for input files and creates them for output. READ statement puts record into input buffer. READ INTO put records into W-S. WRITE writes record from output buffer. WRITE FROM move record from W-S to output buffer and then writes it. CLOSE statement creates a trailer record and releases file back to the system. What types of MOVE do you know? You determine the type of MOVE only by receiving field. 1. Numeric - is right justifying (from right to left). Transaction in Numeric on left-high order digit position Numeric MOVE, conversion will take place if you move one Numeric type to another. If receiving field is longer than sending it will be filled by zeroes, if receiving is shorter the most left part will be truncated. 2. Alphanumeric - is left justified (from left to right). Transaction in Alphanumeric on a right side. There is no conversion. If receiving field is longer than sending it will be filled by spaces, if receiving is shorter the most right part will be truncated. STOP RUN completely releases program from computer memory, and may be used only at the end of Main program. The STOP RUN in the COBOL 85 COMPILER closes all opened files. GO BACK returns control to high level program, and can be executed at any logical level after statement execution. May be used in a Subprogram and in a Main program, returns control to main program from Subprogram, and to the system from a Main program. EXIT PROGRAM statement can be executed only in Subprogram and control of the system is returned back to the next higher level after that statement execution. How can control be passed from one program to another? CALL statement should be executed. (Invokes a Subprogram.) The purpose of Subprogramming is to divide a task functionally into number of programs and to let number of people work on those programs. Main program is a calling program, or program A. Subprogram is a called program, or program B. What is the purpose of a LINKAGE SECTION? To link parameters between a Main program and Subprogram. In a subprogram LINKAGE SECTION is a must, but in a Main program is optional because you set parameters in W-S SECTION. LINKAGE SECTION is not a real storage, only W-S section is a real storage A LINKAGE, SECTION consists of pointers - addresses of the fields in a W-S in a Main program. The purpose of the LINKAGE SECTION is to specify fields listed in the ENTRY statement of the Subprogram. These fields should be defined on the levels 01 or 77. Dynamic call is when links starts only after the CALL statement in the Main program has been issued. Static call means that a Main program and all Subprograms have already been linked together before an execution of a Main program started. How many difference types of entry points do you know? There are 2 types of entry points: 1. At the beginning of PROCEDURE DIVISION. In this case CALL statement should indicate the name of the Subprogram taken from program-id statement of the Subprogram. Entry statement in this case has the following format: PROCEDURE DIVISION USING ... Also you use PROCEDURE DIVISION USING to get a PARM from a JCL. 2. Second types of entry point are points located not at the beginning of PROCEDURE DIVISION. In this case the entry point should be defined through the ENTRY statement and establish an entry point in a COBOL Subprogram: ENTRY entry-point-name USING ...

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna What do you need to have in COBOL program to get data from PARM parameter in JCL? PARM is parameter that is used to pass data to application program. In a JCL EXEC card: //STEP1 EXEC PGM=SAMPLE,PARM=1995-03-07 In a COBOL program: LINKAGE SECTION. 01 PARM. 05 PARM-L PIC S9(04) COMP. 05 PARM-VAL PIC S9(30). ------> (Maximum x (100)) PROCEDURE DIVISION USING PARM. IF PARM-L = 0 DISPLAY NO PARAMETERS PASSED FROM JCL STOP RUN. The purpose of the CANCEL statement is to release a Subprogram from the core. CANCEL statement can be used only in case of a Dynamic call . CANCEL statement is used when a fresh copy of the Subprogram should be loaded into the core every time a CALL statement is executed. Sort There are 2 different Sorts: 1. Internal - Sorts done by COBOL program. 2. External - Sorts done by JCL. What is needed in a COBOL program for an Internal Sort? a. INPUT and OUTPUT PROCEDUREs. b. SD for the Sort file. c. DD statements for the Sort workfile (minimum 3), but not for SD. SELECT SORT-FILE ASSIGN TO UT-S-SORTFILE. ... SD SORT-FILE RECORDING MODE IS F. ... 01 SORT-REC. 05 OFF-S PIC X(08). 05 ACCT-S PIC X(06). 05 FILLER PIC X(....). 05 AMT-S PIC S9(07) COMP-3. ... SORT SORT-FILE ON ASCENDING OFF-S ON DESCENDING AMT-S ON ASCENDING ACCT-S INPUT PROCEDURE IS 100-INPUT-PROCESS OUTPUT PROCEDURE IS 200-OUTPUT-PROCESS. ... IF SORT-RETURN NOT = 0 PERFORM ERROR-RTN. What verbs are used to send and get back records in Sorts? 1. To send - RELEASE. 2. To get back - RETURN. INPUT PROCEDURE used to process records prior to the Sorting, writes them into a Sort file using the RELEASE statement, and must be a Section name. OUTPUT PROCEDURE used to process records after the Sorting, reads Sorted file using the RETURN statement, must be a Section name. USING statement used instead of the INPUT PROCEDURE. Opens Input file, passes Input records to a Sort, close Input file. GIVING statement used instead of the OUTPUT PROCEDURE. Opens Output files, writes Sorted records to Output file, close output file. SORT-RETURN (2 bytes in Binary) is a Special Register used to indicate the result of a Sort. If value 0 - success, 16 - Sort failure. What are the rules for Sort keys? Maximum 12 keys - 256 bytes, located in first 4096 bytes of record.

For a variable

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna record, all keys must be in a fix part of a record. Explain options for SYNCSORT. a. INCLUDE- The records that matching the condition will be on Sort. b. OMMIT - The records that matching the condition will not be on Sort. c. SKEEP - The amounts of lines that will be skip and will not be on Sort. d. INREC - Reformat input file. e. OTREC - Reformat output file. What should be the logic behind a Single Level Control Break program? The program should perform the following basic functions: a.)The program should initialize Hold Control Break Field to the same value as the value of the Control Break Field of the first record. b.)The program then should compare the value of the Hold field with the value of the Control Break Field of the incoming records. If the values are equal the program has to write a detail record and accumulate totals for Control Break Field and if necessary Grand Totals. c.)If the values are not equal, the program has to perform Control Break Logic which involves the following: reinitializing Control Break accumulation field to 0 and moving a new value of Control Break field to the Hold Control Break field. What is the logic behind a Multi Level Control Break program? It goes as follows: a.Input file should be Sorted in ascending sequence based on the values of all Control Break Fields. (For example: DIVISIONS and DEPARTMENT). b.The program should first check for Control Break on the field at highest level and it should check for the Control Break for the fields at the lowest level. COPY statement used to copy any prewriting information from a copy library by a compiler. Mostly copy members that consist of prewriting record layouts. The copied text itself may include a COPY. INCLUDE, ++INCLUDE or INC statements used instead of a COPY in programs stored in PANVALET or LIBRARIAN. DISPLAY or EXIBIT statements used to send messages to the output class. The purpose of the STRING statement is to format one receiving field out of more than one sending field. The UNSTRING statement separates one field into one or more fields named in the INTO clause. COBOL II Enhancements. What are VS COBOL II special features? The support of 31 - bit addressing permits programs to operate above the line and to use larger tables in larger programs. This added space allows VSAM buffer to be placed above the 16 - Meg line, therefore the buffers can be larger. What is the difference between using CONTINUE and NEXT SENTENCE in an IF statement? 1. CONTINUE - execution continues after the next END-IF. 2. NEXT SENTENCE - execution continues after the next period ( .). New option of the PERFORM verb: In-line PERFORM. You can code an In-line PERFORM, making for improved readability, greater structure, and increase flexibility in your logic coding. When you use an In-line PERFORM, you code the performed function right after the PERFORM statement and you end the function with the END-PERFORM delimiter. In other words, the performed function is not coded in a separate paragraph. For example: PERFORM VARYING STATE-INDEX FROM 1 BY 1 UNTIL EOF PERFORM 2100-READ-RECORD IF NOT EOF MOVE STATE-DATA TO STATE-TABLE(STATE-INDEX) END-IF END-PERFORM. The SET TO TRUE statement.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna The SET TO TRUE statement is designed to be used with condition names. By using this statement, using this statement, you can set a condition to true without knowing the value required by the condition. Using SET TO TRUE statement is equivalent to moving the value of a condition to a field. For example: DATA DIVISION. 05 COMMISSION-STATUS PIC X. 88 TRAINEE VALUE 1. 88 ASSISTANT VALUE 2. 88 ASSOCIATE VALUE 3. Coding on with a MOVE statement: MOVE 3 TO COMMISSION-STATUS. Coding on with a SET TO TRUE statement: SET ASSOCIATE TO TRUE. In a case like this, its easier for you to remember a condition name than the value assigned to it. Reference modification. Under the 1974 standards, you can only refer to the entire record or field that is represented by a record name or a field name. Under 1985 standards, though, you can use Reference modification to refer to a portion of a record or field. For example: EMPLOYEE-NAME (3:2), refers to 2 characters in the filed named EMPLOYEE-NAME, starting with 3 character from the left. (MELAMUD) The EVALUATE statement. The EVALUATE statement is an extension of the IF statement and provides the case concept for structured programming. The EVALUATE can take one or more data elements or conditions and specify the action to take. The entries following the word EVALUATE specify what will be evaluated and how many evaluations will be made. You will find EVALUATE can make what would have been long (nested) IF statements much more readable and much easier to maintain. For example: EVALUATE WS1-SEX-CODE ALSO WS-MARTIAL-STATUS Entries following WHEN could then specify values that might be in those fields. The number of comparisons followed WHEN must match the number of entries following EVALUATE. For example: EVALUATE WS1-SEX-CODE ALSO WS-MARTIAL-STATUS WHEN F ALSO S The imperative statement(s) following that entry would be executed if both conditions were true. For example: EVALUATE WS1-SEX-CODE ALSO WS-MARTIAL-STATUS. WHEN F ALSO S PERFORM 3100-SINGLE-FEMALE-EMP Generally, the TRUE options provides more flexibility because a condition may be any valid COBOL condition (e.g., 88-level, data-name followed by relational operator followed by literal or data-name, conditions separated by AND or OR). Testing value of a single filed: EVALUATE WS1-SEX-CODE WHEN M PERFORM 2100-MALE-APP WHEN F PERFORM 2200-FEMALE-APP WHEN OTHER PERFORM 2300-ERROR-RTN Testing truth for a single 88-level or condition: EVALUATE TRUE WHEN 88-level-name PERFORM 2100-RTNA PERFORM 2300-RTNB MOVE Y TO WS1-SWITCH WHEN 88-level-name2 OR condition-a PERFORM 2500-RTNC WHEN OTHER MOVE N TO WS2-SWITCH END-EVALUATE Testing more than one 88-level or condition: EVALUATE WHEN 88-level-name ALSO

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna PERFORM 2100-RTNA WHEN condition-c ALSO 88-level-d PERFORM 2200-RTNB WHEN 88-level-e ALSO ANY PERFORM 2300-RTNC WHEN OTHER MOVE N TO WS2-SWITCH END-EVALUATE Testing more than one data fields: EVALUATE WS1-SEX-CODE ALSO WS2-MAR-STATUS WHEN M ALSO S PERFORM 3100-SGL-MALE WHEN M ALSO M PERFORM 3200-MAR-MALE WHEN F ALSO S PERFORM 3300-SGL-FEM WHEN F ALSO M PERFORM 3100-MAR-FEM END-EVALUATE Testing expressions and literals: EVALUATE LOAN-BAL + NEW-LOAN-AMT WHEN 0 TRUE LOAN PERFORM 3100-ISSUE-NEW-LOAN WHEN LOAN-LIMIT + 1 THRU LOAN-LIMIT * 1.10 PERFORM 3200-WRITE-CHECK WHEN OTHER PERFORM 3300-REJECT-LOAN END-EVALUATE Scope Terminators: Delimiter. The Scope Terminator is a new COBOL II element that allows you define the end of a conditional statements scope without the need of a period. The syntax is straightforward: the letters END-, followed by the name of the effective verb. END-ADD END-READ END-COMPUTE END-RETURN END-DELETE END-PERFORM END-IF END-EVALUATE and others. Example: IF VAR1 IS NUMERIC ADD VAR1 TO HOLD ON SIZE ERROR PERFORM SIZE-ERR-RTN END-IF. Any statement that has conditional elements may use a Scope Terminator where a period is not needed. The preference is to code Scope Terminators every time you code a conditional statement and to avoid using periods except at the end of paragraph. Scope Terminator makes structure clear and you never use unnecessary periods. The INITIALIZE statement. The function performed by INITIALIZE is to reset numeric fields to zero ( and 0) alphanumeric fields to spaces, although there is an optional clause that does a REPLACING BY. First you have to organize your data areas, so one statement can reset all of them. The INITIALIZE statement acts on data fields based on their data type, not their data name. For example: 01 WS-COMMON-AREA. 05 WS-TRANS-SWITCH PIC X. 05 WS-LINE-COUNT PIC S9(03) COMP-3. 05 WS-TOTAL PIC S9. 01 WS2-PREMIUM-TABLE. 05 WS2-PREM-ENTRY PIC S9(05)V99 COMP-3 OCCURS 100 TIMES INDEXED BY PREM-INDEX. You can set all of them to appropriate spaces or zeroes by: INITIALIZE WS-COMMON-AREA WS2-PREMIUM-TABLE. New command: TITLE.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna TITLE command is the ability to place comments in the documents where they will be seen more than once. TITLE generates no code and is active only during the compile process. It serves to place a custom title line on your source listing on every page until another TITLE statement is encountered. Can be coded in any division of program. For example: TITLE METLIFE ANNUAL-REPORT PROGRAM. IDENTIFICATION DIVISION. ... PROCEDURE DIVISION. TITLE TERM POLICY CHART. ... TITLE WHOLE LIFE POLICY. After ADVANCING IN COBOL II, in compiler option use (ADV) - this is a default, therefore system insert 1 empty byte before file, so you have to make sure that if your FD statement for example is PIC X(132), your DCB statement must be 133 bytes, this is very important, otherwise you will get System ABEND 1035. Gone from the Language: 1. 2. 3. 4. 5. 6. EXAMINE is gone -----> use INSPECT. TRANSFORM is gone -----> use INSPECTS. ALTER is gone. EXIBIT is gone -----> use DISPLAY. READY TRACE is gone -----> use DISPLAY. The word TO can no longer be used following an equal (=) sign in compare: Example: IF A = TO B... -----> use IF A EQUAL TO B.... 7. The word IS can no longer be used in the statement: SORT KEY IS...KEYNAME Note: The word IS can still be used with VSAM in the: ... KEY IS ... KEYNAME statement. 8. REPORT-WRITER is gone. 9. CURRENT-DATE and TIME-OF-DAY are gone. 10. The ON option is gone -----> you must replace with logic using counters, such as: IF COUNTERS = 1 PERFORM FIRST-TIME-THRU. 11. REMARKS is gone -----> use * in column 7 instead. 12. POSITIONING is gone -----> use WRITE AFTER (BEFORE) ADVANCING. 13. You can no longer omit the LABEL RECORD clause -----> use LABEL RECORD STANDARD. 14. You can no longer omit the single-quotes on literals declared as PIC X on 88s. Example: 88 EOF VALUE 1 (wrong) 88 EOF VALUE 1 (right)

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna ERROR CODES - ABENDS SOC1 valid. OPERATION EXCEPTION, An attempt to perform machine instruction that is not SOC2 //SYSOUT DD statement is missing from JCL. An attempt to read a file that was not open. Files have not been closed before a STOP RUN is executed.

PRIVILEGED OPERATION EXCEPTION. - Missing period at end of paragraph pr paragraph names. - Missing GOBACK after SORT verb - logic fell into INPUT PROCEDURE.

SOC4

PROTECTION EXCEPTION, The program is attempting to access the memory address that is not within the memory area. - A Subscript or INDEX is out of bounds (for the table). - For Variable length data when OCCURS DEPENDING ON is incorrect. - A Subscript or INDEX is not initialized. - ASSIGN clause in program missing or incorrect. - DD statement is incorrect or missing on JCL. - ADDRESSING EXCEPTION, The program is attempting access a memory address that is outside of available real (central) storage. - A Subscript or INDEX is not initialized. - An attempt to close files a second time. DATA EXCEPTION, Attempt to perform an arithmetic operation on non-numeric Forgetting to initialize a working-storage field. Moving non-numeric field to COBOL output picture such as $zzzzzzz.99.

SOC5

SOC7 data. 013

INVALID OPEN. - PDS doesnt exist. - The BLKSIZE is not a multiple of the LRECL (or some other inconsistency in the DCB subparameters). - Tried to open the printer as a PDS. - The data set was already open. OPERATOR CANCELED JOB WITH DUMP. OPERATOR CANCELED JOB WITHOUT DUMP. A JOB OR JOB STEP HAS EXCEEDED THE TIME LIMIT. - Program is in a loop. - Insufficient TIME parameter on JOB or EXEC card. PROGRAM NEEDS MORE MEMORY. Check the REGION parameter on JOB or EXEC statement.

122 222 322

804, 80A, 878

806

PROGRAM LOAD CANNOT BE FOUND. - Missing or misspelling STEPLIB or JOBLIB statement for library. OPEN FAILED, DSN in LABEL does not match JCL. ATTEMPTING TO CLOSE AN UNOPENED FILE. NOT ENOUGH DIRECTORY SPACE IN PDS. DISK VOLUME IS OUT OF SPACE. - Check SPACE parameter or program logic. PRIMARY SPACE EXCEEDED, NOT SECONDARY. - Should increase primary and specify secondary space.

813 90A B14 B37

D37

E37 -

PRIMARY AND SECONDARY SPACE FILLED. - Specify more volumes. Reorganize TSO library.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna NOT CATALOG2 use IEFBR14 In JCL we should delete on the first step the data set. We can utility or purge the data set before running the job.

PROCEDURE NOT FOUND It means in procedure library where procedure must be cataloged. Check the spelling of procedure name on the EXEC statement. 1035 SYSTEM ABEND. - Conflict DCB parameters. - Invalid DD statement.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna

JCL
Job Control Language - interface between application programs and operating system. It tells the system all the parameters (instructions) we want OS followed for this particular job. Virtual Storage is a capability of the system to execute large amount of program in the small amount of real storage. What JCL cards do you know? JOB - Tells to the operating system that the new job is starting. EXEC - Tells the OS what program or procedure is executed in this particular step. DD (Data Definition) - Describe data set attributes and gives various information about data set. PROC - It marks the beginning of Cataloged and In-stream procedure. PEND - It marks the end of In-stream procedure. /* (Delimiter) - It marks the end of data that is included with the JCL statement. // (Null) - To mark the end of a job. Positional parameter has only values. System recognizes positional parameter by its position. Keyword parameters are coded after positional parameter and can be specified in any order. They are recognized by the keyword followed by ( =) sign. Jobname identifies the job to the system. It must range from 1 to 8 alphanumeric characters, the first character must be alphanumeric or national ( $, #). Jobname must @, be unique. You can code comments in JCL with //* or omit one or more spaces on any JCL statement. Accounting information it is a first positional parameter on a JOB statement. It is defined by the installation and consists of account number and other additional information, such s department, floor, phone #, etc. If it contains any special characters, it as to be enclosed in parentheses of quotes (). Maximum is 142 characters. Programmer name identifies the programmer responsible for this job. characters. (Rules are the same as for Accounting information). Can you omit (exclude) Accounting information and Programmer name? Yes. Instead use commas (,,,) to mark their places. CLASS is a Keyword parameter on a JOB card that establishes priority for the job execution. It has 1 character value. What happens if you omit CLASS parameter? The installation establishes a default job class. What are the categories/reasons for having different classes? Installations generally create different job classes for job by type, depending of the kind and amount of resources used. Small jobs using only disk and producing few print lines are usually given initiation preferences. PGM is a positional parameter, it is an exception: even though it looks like a Keyword parameter, it specifies on an EXEC card that names the program or procedure to be executed. PRTY specifies priority of the job within the class. Values range from 0 (lowest priority) to 17 (highest priority). Highest priority ranges in different installation. Maximum is 20

What happen if you omit PRTY? PRTY will be default.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna MSGCLASS is a Keyword parameter on the JOB card that specifies the destination on JCL output listing. MSGLEVEL is a Keyword parameter on a JOB card that specifies printing of JCL statement and allocation messages and consists of 2 positional sub-parameters: 1. For JCL: a. 0 - Print only JOB card. b. 1 - Print all cards In-stream + Cataloged procedures. c. 2 - Print all cards In-stream but not cataloged procedures. 2. For allocation messages: a. 0 - Do not print allocation messages. b. 1 - Print allocation messages. Usually coded as: MSGCLASS=(1,1) NOTIFY parameter specifies User-ID to which end-of-job messages will be sent. REGION can be coded on JOB and/or EXEC card and specifies the size (amount) of the storage required to execute job or a step. TIME is a Keyword parameter on a JOB and/or EXEC cards that specifies the maximum time for job or step and consists of 2 Positional sub-parameters: TIME=(minutes, seconds). If both coded, both valid, whatever happens first. What is the function of TYPRUN parameter. Depending on the value, it will either hold the job until the operator releases it or will check for JCL syntax errors. TYPRUN=SCAN - means to check for JCL syntax errors. TYPRUN=HOLD - means to hold a job until operator releases it. TYPRUN=JCLHOLD - means the JCL is not checked until the operator releases the job. It is usually done when a preceding job updates a cataloged procedure used in this job. EXEC statement What is the function of PARM parameter? .) To pass data to the program. (Maximum 100 characters What do you need to code in COBOL program when you using PARM parameter? 1. LINKAGE SECTION It consists of two fields: PARM-LENGTH PIC S9(4) COMP, into which the system will place the length of data passed to the program. PARM-VALUE into which the system will place the data itself. 2. Parm-Area. 3. PROCEDURE DIVISION USING Parm-Area. COND is a Keyword parameter on a JOB and/or EXEC card and specifies condition for executions of job steps. If COND parameter is true the step which contains this parameter will be bypass. It consists of 3 sub-parameters: 1. Code number. 2. Logical operator (comparison). 3. Name of the step returns code, which is compared with (Optional). COND=(4,LT) - means if 4 less than return code from previous step, this step will be bypassed. If stepname is not specified, return code of every previous step will be tested against the condition. GT - greater than LT - less than GE - greater than or equal LE - less than or equal EQ - equal NE - not equal What happens when you code COND on both JOB and EXEC cards? COND on JOB statement overrides COND on EXEC statement. COND=EVEN - means that the step will be executed even if previous step ABENDed. COND=ONLY - means that the step will be executed only if one of the previous steps ABENDed. You can not specify COND=ONLY, COND=EVEN on the same card (together).

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna If you want to find out exact BLKSIZE for DSN you must divide 27998 by LRCL, then get even number out of the result, and multiply it by LRCL. System completion code may have values: 0 - no errors 4 - possible errors 8 - serious error 12 - severe error 16 - fatal error DD statement What is Referback parameter? We use Referback parameter whenever we want to copy all information from another DD card. //ABCFILE DD DSN=*. Stepname. DDname What is the limit for DSN? 44 characters including periods. What is UNIT parameter and what are the values? UNIT is a Keyword parameter on a DD card that specifies device used by a file. Most of the time it depends on the installation. Usually the values are: TAPE - for tapes. DISK, SYSDA - for disks. Or you can specify the disk model: 3330, 3350, 3380, etc. DISP parameter specifies the disposition of the data set after the job will end and consists of 3 positional subparameters: 1. File status - identifies the status of the data set: NEW - specified when the file is being created (and allocated) in this step. It is used for output files only. OLD - specified for already existing Input and Output files and it means that this file can not be used by other jobs while this job has control of it. SHR - specified for already existing Input or Output files. It means that this file can be shared by other jobs. MOD - is used for new or existing file. It is used for output files and indicates that this file will be expanded (modified). When file is opened, the read/write mechanism is positioned after the last record written. New records will be written at the end of existing records. 2. Normal termination action - indicates action to be taken by the system when the job terminates normally: KEEP - it keeps data set permanent. CATLG - it catalogs data set at the end of the normal job termination. PASS - it passes the data set to the following steps and each step can use this data set once. UNCATLG - it uncatalog data set, the entry in the catalog deleted, but the data set itself is still kept on the volume. DELETE - it deletes the data set. Cataloged data sets are uncataloged. 3. Abnormal termination action - what to do with data set in case of ABEND. KEEP - the data set will be kept if the step Abends. DELETE - the data set will be deleted when step Abends. CATLG - the data set will be cataloged when the step Abends. UNCATLG - the data set will be uncataloged when the step Abends. What is the benefit of using PASS? It saves time for data set allocation; the system retains information about location and volume. Mountable volumes remain mounted. What is the default if DISP parameter is omitted? DISP=(NEW,DELETE,DELETE) What parameters do you need to code for cataloged data sets? DSN and DISP, the rest of the information the system will get from the catalog. What parameters do you need to code for uncataloged data sets?

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna All parameters, so the system can locate this data set. What is DCB parameter? Data Control Block. It specifies data block information such as record length, block size, record format, etc. a. LRECL - The length of the logical record. The value must be the same as in RECORD CONTAINS clause in COBOL program. b. BLKSIZE - Specifies the size of a block in bytes. c. RECFM - It specifies the record format, which can be fixed, variable, undefined, etc. d. DSORG - It indicates type of data set organization. PS - Physical sequential, PO Partitioned organization, IS Index sequential, DA Direct access. e. BUFNO - It indicates the number of buffers assigned by the system in process the data sets. f. DEN (not common) - It may be used for tape data sets and specifies the recording density in bits per inch. The default for DEN is defined by the installation. Logical record is one record described in FD and processed by the program. Physical record is a block or records and consists of logical record. Blocking factor indicates the number of logical records per one physical record. Explain some possible value of RECFM parameter. The values must be compatible with RECORDING MODE clause in application program. First character can be: F - For fixed length records. V - For variable length records. U - For undefined D - For variable-length ASCII tape records. Second character can be: B - For blocked records (FB, VB, UB - is not allowed). A - ASA control character. It is used t to control a printer. Combination of two-second characters is allowed. For example: RECFM=FBA for a fixedlength blocked records which will be printed. How do you specify BLKSIZE for fixed and variable undefined length records? Fixed - It must be a multiple of LRECL. Variable - It must be the length of the longest record plus 4 bytes for control information. Undefined - It must be as large as the largest block. What is the short form of coding DCB parameter? DCB=keyword=value. For example: DCB=BLKSIZE=8000 What is SPACE parameter? SPACE parameter is coded for new files on DASD and specifies disk space allocation. It consists of 4 positional subparameters: Unit of allocation (TRK, CYL); primary, secondary and directory blocks; RLSE; CONTIG. How does the system compute the amount of secondary space when you use blocksize? It allocates it by multiplying the secondary allocation number by BLKSIZE of DCB, rather than blocksize of SPACE. What is the function of secondary allocation? When the primary space allocation is full, a secondary allocation will be made. What is the maximum number of extents, which can be allocated for a data set? 16. 1 for primary, 15 for secondary. It allocates primary units of allocation first, and if its not enough, it will dynamically allocate up to 15 secondary allocation. What is CONTIG? CONTIG forces the primary allocation to be contiguous (close) in one extent only, which means that all tracks in the allocation are in the same or adjacent cylinder. What will happen if you specify CONTIG and there is not enough contiguous space to satisfy the primary allocation?

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna The Job will fail. What is the advantage of using CONTIG? CONTIG is more efficient because it save time on access mechanism arm movement when accessing data. What does RLSE mean? RLSE releases all unused space when the data set is closed. What is LABEL parameter? LABEL parameter specifies the type of label on tape files only. SL standard labels (default). NSL non-standard labels. SUL combination of standard and user label. BLP bypass label processing. NL no labels. EXPDT REPTD It is used in order to request an expiration date for a file on tape. LABEL=EXPDT=yyddd. It is used in order to request a retention period for a file on tape. LABEL=REPTD=9999. Specify Specify

Temporary data sets are data sets, which are created and deleted within one job. They last only for the duration of the job. It specifies && followed by 1 - 8 characters name: DSN=&&dsname or by omitting DSN parameter. Usually, object module created by the compiler is a Temporary data set - it is passed to the linkage-editor step. In application programming, we use Temporary data set to save the storage, for example when there is a need for an intermediate file, which does not have to be saved after the job terminates. How do you refer to the Temporary data set from the subsequent steps if DSN was omitted? Using Referback DSN: DSN=*.stepname.ddname. What value of DISP do you give when you create Temporary data set? DISP=(NEW,PASS) What is a DUMMY data set? A sequential data set may be assigned a dummy status in which all I/O operations are bypassed and device allocation, space allocation and data set disposition are ignored DSN=DUMMY or DSN=NULLFILE. Usually you use during testing. For example to suppress printing report files. Which parameter must be coded with DUMMY data set. BLKSIZE is required by the system in order to open files, when the files are opened the system obtain buffers. Define Concatenated data set. Several data sets that are processed by the system as one. several data sets.

You specify 1 DDname for

What are the rules for Concatenated data set? 1. They must reside on the same type of devices (tape, disk). 2. Data sets must have the same DCB information. 3. Data sets must be concatenated in the order in which they will be read. 4. Data set with the largest BLKSIZE must be coded first. 5. You can not concatenate PDS with sequential files, but individual member of PDS you can. How many Partitioned and sequential data sets can be concatenated? 1. Partitioned Maximum of 16. 2. Sequential Maximum of 255. What type of Procedure do you know? Cataloged A set of JCL statements, which can be used by many users. In-stream A procedures which are placed within the input stream, right after the JOB statement. What is the function of PROC statement?

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna It marks the beginning of procedure.

EXEC PROC=procname or EXEC procname.

How do you recognize an In-stream procedure? It starts right after the JOB statement and begins with PROC statement and it ends with the PEND statement. You can invoke the In-stream procedure several times within one job and you can have up to 15 procedures in one job. How do you modify the procedure? By overriding parameters and/or by using symbolic parameters. Symbolic parameters has to specified with & and provide alternative means for modifying procedures of execution and require a PROC statement, the EXEC statement overrides the PROC statement for the duration of the job. How can cataloged procedure be updated? By IEBUPDTE utility program. How do you override parameters, which belong to EXEC statements of the procedure? On EXEC statement invoking that procedure, specify the name of the parameter you want to change followed by the period (.) followed by the stepname, then equal (=) sign and the new value. //stepname EXEC PROC=procname, PARM.step=newvalue. In this way list all parameters you want to change. How do you override parameters, which belong to DD statements of the procedure? They can be overridden, nullified or added, or an entire DD statement can be added. After the EXEC statement invoking the procedure, list separately all DD statements you want to change in the following way: //stepname.DDname DD parameter=newvalue. How do you add new parameters to DD statement? Just specify it on override DD statement. How do you override Concatenated data sets? They must be overridden individually in the same order they appear in the procedure. Define generation data sets (GDS or GDG). Group of data sets that are logically and chronologically related. They can be Sequential, Direct or Partitioned. VSAM files can be GDGs. GDGs reside on tapes or DASD. They must be cataloged. You create them through IDCAMS. The maximum number of entries to be contained in the alternate index is 255. How do you refer to a GDG? By a: a. Absolute name - The real name of a data set in a GDG consists of the data set name and a final name portion made up of GxxxxVyy, where xxxx is the generation number and yy is the version number. b. Relative generation number - An integer which identifies the generation of a data set and is coded in parentheses ()at the end of the data set name. Give example of relative generation numbers and explain their meaning. 0 - Current generation. -1, -2, etc. - Past generation. +1, +2, etc. - Future generation. What is the advantage of generation data groups? All data sets have the same name and the system keeps track of adding new and deleting old generation. When is GDG number updated? At the end of job. How can you access GDG through TSO/ISPF? By specifying either the data set name and relative generation number, or the absolute data set name.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna What happens when you omit generation data number when the numbers of entries approach G9999? All existing data set generations are accessed, generations are accessed in reverse order and the generations are received by the program as if they were continuous (concatenated). How do you delete all existing generations? With IEFBR14 utility without specifying generation number DISP=(OLD,DELETE). cause the model to remain without containing data set references.

This will

Is it possible to skip a generation - instead of specifying +1 specify +2? Yes. There will be no error, but it will result in a hole in absolute generation number. Miscellaneous How do you restart a job from a particular step? Specify RESTART parameter on a JOB statement. Example: RESTART=stepname . How do you use UNIT=AFF? UNIT=AFF-ddname is coded to assign data sets on mountable volumes to the same unit used by another data set. The DDname must be the name of the previous DD statement in the same step. Specifying UNIT=AFF allows the number of devices needed by the step to be minimized. Especially used with tape concatenated data sets. JOBLIB card indicated that a program would be searched for in a private library for the entire job. STEPLIB indicates that a program will be searched for in a private library for a particular step. STEPLIB takes precedence (preference). JOBCAT specifies private library where catalog data set of this job could be located. STEPCAT specifies private library where catalog data set could be located for particular step. How do you allocate a data set on multiple volumes? VOL=SER=. Also usually when you allocating a dataset under your User-id. What is the function of AMP parameter? DCB parameter cannot be coded for VSAM data sets. AMP is used instead. For example, BUFND=n specifies in the number of buffers for control area data (need at least two). BUFND=n specifies the number of buffers for index data (need at least one). How do you access VSAM files from programs written for ISAM? Specify AMP=AMORG on DD describing that file. When do you specify AMP=AMORG? When we access VSAM files from program written for ISAM files and when DD statement describes VSAM file and is made DUMMY. Which linkage editor DD statement do you know? //SYSLIN For input. //SYSMOD Load module. //SYSPRINT To print data set. //SYSIN Used by compiler. //SYSLIB Call libraries. IBM Utilities Utility programs can perform a variety of different functions, which eliminate the need for special application programs and/or operators interference during the job execution. IEHPROGM IEBGENER IEBCOPY IEBMOVE IEBPTPCH IEBUPDTE Data set maintenance. Copy sequential data sets. Copy and compress partitioned data sets. Copy or move sequential, PDS, or direct data sets. Print or punch data sets. Maintain source libraries.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna IEHLIST IEFBR14

List direct-access volume information. Delete, allocate, find data sets.

What is the function of //SYSPRINT DD SYSOUT=* statement? It prints the utility messages. Which DD statements describe input to and output from Utility programs? //SYSUT1 DD Describes an input data set. //SYSUT2 DD Describes an output data set. How do you code Utility program control statements? //SYSIN DD* control statements /* What is an alternative method specifying control statement? //SYSIN DD DSN=data.set.name(member), DISP=SHR SORT What DD statements do you need to include in the step invoking the SORT? SORTIN DD - To specify the input data set (sequential or VSAM). SORTOUT DD - To specify the output data set. SYSIN DD * - To specify the sort control cards. STEPLIB DD - To specify the library, which contains the sort, program (usually SYS1.LINKLIB). SYSOUT DD SYSOUT=A - To sort output messages. SORTLIB DD - To specify the library for special sort utility routines (usually SYS1.SORTLIB). SORTWKnn DD - To specify 3 to 6 word data sets What is the format of SORT FIELDS control statement? SORT FIELDS=(starting position, length, date type, order) How many sort keys can you specify in one sort? Up to 12. List common values for data type format? CH EBCDIC characters. ZD Zoned decimal. PD Packed decimal. BI Binary. How do you specify ascending or descending order of sort? A for ascending, D for descending.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna

VSAM
Virtual Storage Access Method. KSDS (Key Sequence Data Set - is like an ISAM sequentially and randomly based on a key value. ESDS (Entry Sequence Data Set) - is like a records are processed one at a time in the order RRDS (Relative Record Data Set) - is like a be accessed based on their relative positions in file. Its records may be processed

standard sequential data set. Its in which they were loaded. non-VSAM relative file. Its records can the file.

Control Interval is a unit of data VSAM transfers between Auxiliary (disk) and Virtual storage. It contains: a. One or more logical records (LRA-Logical Record Area). b. Unused (free) space, which is used in order to add or expand records to the VSAM file. Control information, which consists of: c. RDF (Record Description Field), there is one RDF for each record in the CI. d. CIDF (Control Interval Descriptor Field) which has 2 main functions: 1. Keeps track of free space within the CI. 2. Contains a flag thats set when the CI is in the process of being updated. If your records are all the same lengths, you must allow for 10 bytes of control information (One 4-bytes CIDF and two 3-bytes RDFs). And if your record length vary, you must allow for more. What is Control Area? Area which contains Control Intervals. What is maximum and minimum size of Control Interval and Control Area? Maximum size for Control Interval is 32K and minimum is a track, or even less. Maximum size of Control Area is 1-cylinder and minimum 512 bytes. During CI split all records of the specific CI starting with the record containing next highest key than record to be inserted will be moved into CI with freespace only to make room for the record to be inserted. During CA split all records starting with the record contains next highest key than record to be inserted will be moved into CA with freespace only. To prevent the CA or CI split the following steps can be taken: 1. Accurate amount of interval and external percentage of FREESPACE allocation should be specified. 2. VSAM file reorganization should be provided on a constant basis depending on the activity against that file. The purpose of the VSAM file reorganization is to restore internal and external percentage of the FREESPACE allocations. VSAM file reorganization should be done in the following two steps: 1. Unloading (REPRO)of the VSAM file onto tape or any other sequential file. 2. DELETE/DEFINE VSAM file. 3. Reloading (restoring REPRO) of the VSAM file back from the sequential file. KSDS cluster consists of 2 parts: 1. Data component, which represents the actual records of a file (ESDS, RRDS, or KSDS). 2. Index component, which represents the indexes for KSDS. Each index record consists of the highest key of CI it points to the direct address of that CI on the disk. Index component has a hierarchical structure and has two parts: 1.A Sequence set is a lowest level of the index. Its searched to determine which control interval in the data component contains a particular record. It also calls sequence set because it contains horizontal pointers between CI. 2.An Index set is used to locate sequence set records. If you want to define VSAM data set you should: 1. VSAM data space has to exist on the desired volume, if not, IDCAMS DEFINE SPACE function should be executed for that volume.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna 2. Following IDCAMS functions should be executed: a. DEFINE CLUSTER. b. REPRO - will load VSAM cluster from another VSAM file or sequential file. Which IDCAMS function should be used in order to print out records of the VSAM file? PRINT function. How to find out that ALTERNATE INDEX (AIX) contains duplicate? IDCAMS PRINT command should be used against that AIX. Then we have to analyze the printout and if one of the AIX records contains more than 1 pointer to the Base cluster that would indicate that AIX contains duplicate. How could you print catalog information about specific VSAM data set or certain information from VSAM catalog? Using LISTCAT. How to delete VSAM catalog? IDCAMS DELETE function should be used.

Its also can be used for non-VSAM.

How could you catalog non-VSAM data set in the VSAM catalog? DEFINE NONVSAM function should be used. What is the purpose of ALTER function? The purpose of the ALTER function of the IDCAMS program is to able to change the catalog information about VSAM file without deleting it or reallocating it. FILE STATUS is 2 bytes field which should be define in the W-S SECTION and which should be checked after any I/O operation like: OPEN, WRITE, READ, DELETE, CLOSE against VSAM file. What is a record key? Record key indicates to the system where in the record of the VSAM file the key is located. Record key should be describe in the FILE SECTION. What is the purpose of the START command? The purpose of the START command is to position a current record pointer on the desired record. This command should be followed by a READ statement, which will bring that record into the program. How can a record in the VSAM file be changed? Following steps should be executed: 1. MOVE tran-key TO record-key field. 2. READ a record from VSAM file. 3. REWRITE the record. 4. Check for the FILE STATUS. Acceptable value of FILE STATUS is 00. How to add a record in the VSAM file is changed? Following steps should be executed: 1. MOVE tran-key TO record-key field. 2. WRITE a record to VSAM file. 3. Check for the FILE STATUS. Acceptable values of FILE STATUS are: a. 00 - successful. b. 21 - record out of sequence (sequential access only). How to delete a record in the VSAM file is changed? Following steps should be executed: 1. MOVE tran-key TO record-key field. 2. DELETE a record. 3. Check for the FILE STATUS. Acceptable values of FILE STATUS are: a. 00 - successful. b. 23 - record not found. In any other case program should be terminated. How could you find out what are the values of different parameters for existent VSAM cluster? LISTCAT ENTRIES ALL. What is the layout of ALTERNATE INDEX record?

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna First field in the ALTERNATE INDEX record is an ALTERNATE INDEX itself. will follow that field to the Base Cluster as there are duplicate.

As many pointers

To allocate a unique VSAM cluster in the VSAM data space, UNIQUE option should be used in the DEFINE CLUSTER option. What is the difference between UNIQUE and SUBALLOCATE? In case of UNIQUE, cluster will be the only one within VSAM data space. In case of SUBALLOCATE, cluster will be occupying just part of the VSAM data space. How to find out what is the number of CI and CA splits for VSAM file? This information is listed in the report produced by LISTCAT entry function of the IDCAMS program. The purpose of VERIFY function of IDCAMS is to verify whether VSAM file was properly closed. SHARE (SHR) option defines how this VSAM Cluster could be used in the system and consist of 2 subparameters: 1. Option 1 indicates how the VSAM file will be shared between multiple users within the same region. If option 1 = 2, in this case VSAM file could be read and update by multiple users within specific region. 2. Option 2 indicates how the VSAM file could be shared across the system. If option 2 = 3 in this case VSAM file could be read only by users in another region. FREESPACE parameter is used to specify the percentage of free space within CI and CA. FREESPACE (10 5) a. First positional subparameter gives internal allocation (CI). b. Second positional subparameter external (total) allocation (CA). ALTERNATE INDEX is additional key that could be used for random processing against VSAM data set. Up to 255 additional alternate keys could be define for the VSAM cluster. Before ALTERNATE INDEX could be created the Base Cluster should exist and loaded with at least 1 record. Then the following IDCAMS functions should be executed: 1. DEFINE ALTERNATE INDEX - This function defines different parameters such as: keys, space and others for AIX to be build. 2. DEFINE PATH - This function defines a path between AIX and Base Cluster. 3. BUILD INDEX (BLDINDEX) - During execution of this function Base Cluster is opened as input and AIX are build, sorted and Index Component of the AIX data set is created. What is program logic to process duplicates through AIX? The program has to executed and performs a certain routine until all duplicates are processed. After each READ command on the AIX that routine should check FILE STATUS. If FILE STATUS is 02 that mean there are more duplicates to be processed. If 00 that means there are no more duplicates. If FILE STATUS is 23 that means that record was not found. What VSAM performance options do you know? IMBED and REPLICATE. They could be used for DEFINE CLUSTER or DEFINE AIX functions. 1. In case of IMBED Sequence set CI will be replicated (copied) as many times as it could fit on the first track. 2. In case of REPLICATE, not only Sequence set CIs, but also higher levels CIs of the Index set will replicate as well. IMBED and REPLICATE options reduce rotation movement of the disk and because of that response time will be better, but that will require usage of more space. IMBED and REPLICATE is usually used for the VSAM files allocated to On-line regions. UPGRADE is a function of DEFINE AIX only, UPGRADE means that when ever Base Cluster is updated all relative AIX will be automatically updated similar if DD statement for that AIX is specified in the JCL. UPDATE is a parameter of DEFINE PATH function and when that parameter I used AIX will be updated automatically as soon as Base Cluster is updated even if DD for AIX is not defined in the JCL. How to process VSAM file sequentially using ALTERNATE INDEX? Perform the following steps: 1. The program has to use START command that names the AIX.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna 2. The program has to use a READ new record command with at end READ VSAM master NEXT record AT END PERFORM at-end-processing. How ALTERNATE INDEX specified in JCL? A separate DD statement should be specified for any AIX processed by the program. The DDname for the AIX is created out of the DDname of the Base Cluster when the last character is replaced by 1, 2 or 3 and so on depending on how many AIXs are processed by the program. AIX path name should be specified on that DD statement. What is specification of VSAM file for the COBOL? FILE CONTROL. SELECT file- name .... ASSIGN file-name ... ORGANIZATION IS INDEX (for KSDS) [SEQUENTIAL] ACCESS MODE IS [RANDOM] [DYNAMIC] RECORD KEY IS data name FILE STATUS IS data-name ........... PROCEDURE DIVISION. ........... START file-name. [equal to = ] KEY IS [greater than >] data name. [less than <] What are parameters for the JCL? 1. NAME - The name assign to the Cluster, Data Component or Index Component. 2. VOLUME - Volume serial number. 3. RECORDS (primary, secondary) - Specify the number of records the primary and secondary areas are to contain. Code CYLINDERS or TRACKS in place of RECORDS to request space in these units 4. RECORDSIZE (average maximum) - Specify the average and maximum record sizes, they will be the same for fixed-length records. 5. INDEXED - for KSDS. 6. KEYS (length position) - Specify the length of the record key and its relative byte position (0 to n) in the record. 7. UNIQUE - Means that only one Cluster will be within VSAM data space. 8. MODEL. 9. SHARE. 10. FREESPACE. 11. DATA - Defines the Data Component of the Cluster. 00 or 97 - successful completion. 02 - duplicate alternate index. 10 - end of file reached. 21 - sequence error, out of ascending order. 22 - duplicate key. 23 - record not found. 24 - no more space. 92 - logical error. 95 - incorrectly define parameters.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna

DB2
A Relational Database is a Database management system in which all the data is perceived (received) by the users as a collection of tables. Database is a collection of data with relationship between different parts of data. possible to maintain the links between related data. Primary key One or more columns which makes a row unique. It is

Foreign key - Column in one (Dependent) table which refers to a Primary key in another (Parent) table to retrieve data when the match is found. It is defined in the CREATE TABLE statement or in an ALTER TABLE statement. Referential integrity - Is the assurance that all references between tables are valid; The problem of avoiding invalid Foreign key. References integrity rules are: 1. On delete Cascade: If Parent row (i.e. Primary key) is deleted, all matching dependent (foreign keys in the same or other tables will be deleted). 2. On delete Restrict: Only permits deletion of Parent row if no matching dependent rows exist (in the same or other tables). 3. On delete Set Null: If Parent row is deleted, matching Foreign key is set to Null. You specify those rules on Dependent table. Normalization is a theory of logical database design that provides for a minimum of data redundancy (repetition) and a maximum of data integrity (completeness). The object is to create many small tables with minimum redundancy. What is an object? An object is anything that is managed by db2 (that is, databases, tablespaces, tables, views, indexes, or synonyms), but not the data itself. What is the optimizer? This is the component that the bind process uses to estimate the most efficient access path to satisfy each sql data base request. It is the intelligence of db2. What are the component of sql? 1. Dml (data manipulation language) - handles the retrieval and updating of data (select, update, insert and delete). 2. Ddl (data definition language) - provides you with the ability to create, change and delete db2 objects (create, alter and drop). 3. Dcl (data control language) - provides control authorization to access and use the database (grant and revoke). Name the build-in functions and describe their operation and how are they operates? 1. Sum - compute the total of all values in the column. 2. Avg - compute the average of all values in the column. 3. Min - select the lowest value in the column. 4. Max - select the highest value in the column. 5. Count (distinct) - counts the number of rows, eliminating duplicates. They operates like control break functions; you can have them operate over the entire range of the table or over sub-groups which you specify in the group by clause. In Between Like% All and any - subselect. - to search a range of values. to search partial. in correlated (correspond) subselect.

What are host variables and where do they come from? Host variable (:) are the programs data areas where the sql statement deposits its results. They can be coded by hand, but are usually included from a dclgen library. Join is a query that produces a result table-combining column from more than one base table or view.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna When you cannot use join operation? When update cursor. What is cursor processing? Cursor processing is a way to bring multiple rows of a table into application program one at a time. Should begin with declare cursor which performs the select statement to bring in only selected data. Then the open cursor that physically gets the data from the table. The fetch command that brings in individual rows of the table. At this point ask how we know the last row of the table has been processed +100 sqlcode will be returned, finally the close cursor closes cursor. What do you do after the end-exec on the fetch? Check for if sqlcode = +100 (end of file) means no more rows or no more rows to begin (not found). During cursor processing, how do you update rows of that cursor? Can do an update where current of cursor, or can do an update using the key brought into w-s on the fetch command, or can select for update and then do update using key from fetch. How can you select only one rows of a table that have unique values particular (e.g. only wish t extract one row from a order table for each item type)? Use select distinct. Union merges (combining) results final result table does not have Union all completely differently statement. It does not sort and we

table from 2 or multiple select. It also ensure that the any duplicate rows . Union sorts the result table from a join, combining the result of two select does not eliminates duplicates from the result table.

Order by sorts the final result table (specify the sequence in which the rows will be return in result table). If many queries are joined together, the order by will sort the result of the union. The maximum is one per query. If you do not specify order by clause the rows will be returned in the order in which they are stored physically. How can you work through a result table in reverse order? You cannot. However, you can specify the sort key as descending in the order by clause. Dclgen is a table declaration (copybook). It can be created using db2i and contains a host language w-s layout of the table or view. You would bring it into your program with: exec sql include (dclgen_name) end-exec. Commit closes all cursors, it also makes all updates final (exec sql commit end-exec). Commit can be explicit (when command commit is coded) and implicit (successful end of program, task). Option rollback similar to syncpoint with option rollback in cics. Commit making a change permanent. Commit frees resources (tables and plans) and saves you from having to return an entire job when only one part has failed. It closes all cursors and cursor position will change. But db2 release 2.3 with hold option will not close cursor after commit and cursor or position will remain unchanged. What effect does a commit or rollback have of any or all of the open cursors that are being processed? As soon as a rollback or commit is issued, all of the open cursors are immediately closed. When this happens all cursor positions are lost . Rollback will back out all changes up to the point of the last commit executed in program. When db2 issues rollback? 1. When program abends. 2. When you code: db2 uses locks to ensure that no other user accesses data that has been changed by another user but not yet committed.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna View - a virtual table, really a catalog entry that contains a set of pointers to columns in one or many base tables. The advantages of using view is primary security, also to simplify programming tasks. A view restricts access to specific columns and rows. Example: create view viewname (column, column, .....) as subselect ..... A person who binds the program must have update authority on the accessed by that view. For inserts, all columns of the table that is accessed by the view do not have default values must have data inserted. Therefore any that do not access all non-default columns for the tables accessed the view can not be updated. If a view is created using built in db2 functions (sum, avg, etc.) Or using group by or distinct, only a select operation may performed against this view. If any of the columns in a view are created using arithmetic operation (e.g. age + 10) no update function may be performed against this and no insert operation may be performed against the whole view. You allowed to perform delete functions and update operations against the columns. If with check option is specified when view created, all insert with update operations are checked to ensure conformity with view definition. Why would you use a view? Why not just process against the table? A view allow us to restrict the rows within a table that a user use to access, thus improving system. Security. This is the main reason, however others may be acceptable (such as makes sql easier due to worrying about columns that are not to be processed). Before you create a table database, tablespace and stogroup or data set must exist. Base table where the data is physically stored on the device. output of a query in the form of a report, a temporary table.

Result table

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). minimize the amount of physical i/o actually performed with 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. What are data types? They are attributes of columns, literals, and host variables. The data types are: 1. Smallint - pic s9(4) comp, range +32 to -32k. 2. Integer - pic s9(9) comp, maximum over 2 billion. 3. Decimal - pic s9(m)v9(n) comp-3, where m + n not greater than 15. 4. Char - pic x(n), where n is maximum = 254. 5. Varchar - pic s9(4) comp, length field; pic x(n), data field, max. N = 4046. NULL is missing data, value unknown. What is an Index? Indexes are external pointers that are specified by the user but never used by him. Indexes used by the system to retrieve data directly from database. For uniqueness constraint we create the Indexes for faster retrieval of data. We retrieve the value of the column with matching. There are 3 kinds of Indexes: 1. Unique - Restricts INSERTs or LOADs into the table to a single row with a Particular Index key value. You will get SQLCODE -803 trying to violate uniqueness criteria. 2. Non-unique - Allows any number of rows in the table with same key value.

It

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna 3. Clustered - Is one for which the sequence defined by the Index is the same as, or close to physical sequence of sorted data. Clustered Indexes are extremely important for optimization purposes. Indexspace is a Index data that physically stored in an Indexspace. The page size of an Indexspace is 4K. They are creating automatically when Index is created. What is meant by concurrency? Concurrency is what allows more that one DB2 application process to access the same data at essentially the same time. Problem may occur, such as lost updates, access to uncommitted data, and unrepeatable reads. A Storage group is a set of one or more DASD volumes, where data is allocated. How can you update table to add an extra column? ALTER table - to add a new column at the end of the table columns. How to find out information about Table and Index? Run EXPLAIN. EXPLAIN is used to create an entry in the PLAIN_TABLE that gives data such as whether an Index is used, or if a data sort is perform, etc. Options in EXPLAIN, PLAIN_TABLE: a. APPLNAME - holds the name of application plan being bound or rebound. b. PROGNAME - name of DBRM within the plan which contains the explained statement. c. PLANNO d. METHOD - 0 - means the table is the first table accessed. - 1 - mean nested loop join. - 2 - mean scan join. - 3 - mean internal sort. e. ACCESSTYPE - R - tablespace scan is used. - I - index used to access data. f. MATCHCOLS - number of columns in the index that are matched in query (0 - nonmatching index scan). If it is greater than 0, DB2 is using a matching index scan to access data. What is DB2 DB2 EXPLAIN data in the data. EXPLAIN can the EXPLAIN Explain Facility? provides access path information about an SQL statements. EXPLAIN places that users PLAIN_TABLE. It is the user responsibility to select and analyze that be activated two ways; through SPUFI with the SQL EXPLAIN statement, or with (YES) parameter on the BIND command.

Using the PLAIN_TABLE, how do you identify an Indexspace Scan? Access = I for Index and Matched Columns = 0. EXISTS is the Existential (absolute) qualifier. If is found in the WHERE clause and is followed by a SELECT statement. If the Inner SELECT statement returns at least one row, The Existential qualifier is turned ON and logically the exists condition is satisfied. If the Inner SELECT returns zero rows, then the result is negative. What are the values of SQLCODE and what do they mean? 1. 0 - Mean no error. 2. Positive and Less than +100 - Means warning. 3. +100 - Means not found or end of data. 4. Negative - Means error. WHENEVER provides automatic branching to special error handling modules. You can code WHENEVER SQLERROR, WHENEVER NOT FOUND or WHENEVER SQLWARNING. If you dont want it to send you to another paragraph, code WHENEVER ....... CONTINUE. DSNTIAR is a called module that provides a textual description for a DB2 error code. RCT (Resource Control Table) - It defines the thread connecting the CICS TRANS-ID to the DB2 Plan and contains authorization information: 1. The name of DB2 sub-system.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna 2. RCT suffix identifier. 3. TRANS-IDs connected to an Application Plan. 4. Type of tread for each Plan and others and maximum number of threads (concurrent users) that DB2 - CICS connection can have. There is one entry for each TRANS-ID and each Application Plan is associated with one or more TRANS-ID. PRECOMPILE Syntax checks SQL code (internally only, it does not access the DB2 catalog); replaces SQL code with Host language (COBOL) MOVE and CALL statement; creates DBRM. COMPILE and LINK - Standard COBOL compile and link (note the link must include the DSN Host language interface program). BIND - Uses system catalog to validate SQL code; verifies users authorization; SELECTs optimum access path (user optimization); creates Application Plan. What is REBIND? REBIND produces a new Application Plan if DB2 structures are changed or dropped (for example, when index on table is dropped). What is the difference between BIND and REBIND? Both produce Application Plan. But BIND uses DBRM and DB2 Catalog to produce Application Plan. REBIND uses existing Application Plan and DB2 Catalog (it does not use DBRM). Result of REBIND is a new Application Plan, but TIMESTAMP is coming from old Application Plan (DBRM). Application plan is control structure that describes the actions that need to be taken in order to execute each SQL statement. Application plan produced during BIND step, is used by DB2 when application program is executed. Application plan contains information about program and data which we are intended to access. Application plan stored in DB2 directory and information about it is in the DB2 system catalog. Database Request Module (DBRM) - It is the output of the Precompile and input to the Bind. It is modified source program in which the SQL statements are replaced by host language statements. What are DB2 - CICS Recovery? There are two types of Recovery: 1. Can be done by DB2. 2. Can be done by CICS. (Two phase COMMIT). 2 Phase of COMMIT. CICS reaches SYCPOINT or RETURN and tells DB2 to prepare to commit. Phase 1: (Preparing to COMMIT), CICS issue SYNCPOINT command. SYNCPOINT may be issued: - by coding it in Application program - when transaction ends with EXEC CICS RETURN END-EXEC In phase 1 DB2 logs its updates but does not release any locks. If phase 1 was successful, CICS tells DB2 to COMMIT, if unsuccessful, CICS tells DB2 to ROLLBACK Phase 2: DB2 logs its COMMIT and releases locks n resources. If DB2 crashes after phase 2 begins, it will complete the COMMIT when it is restart. -

What is the Package? A Package is a collection of DBRMs. Each DBRM is bound in separate package which can be rebound separately (BIND with option replace). (Version 2.3) Application Plan consists of several packages. Every package belongs to one Application program. When we change one program we BIND with replace only one package (with which this program is associated), not Application Plan. Code -805 - if timestamps in package and Application program isnt corresponding. What is -818 error?

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna TIMESTAMP, It is execution time error because the TIMESTAMP of load module and DB2 Application Plan did not match. In CICS, forgot to do new copy. We must Precompile again, Compile (with link-edit), BIND (with option DBRM). What is SQLCA? SQL Communication Area. Every COBOL program containing embedded SQL must have an SQLCA. SQLCA holds information about every SQL statement that has been executed and error codes. SQL code - the element of the SQLCA that contains the return code for the last SQL statement executed. SQLERRD(3) - the element of the SQLCA that holds the number of rows that were inserted, updated or deleted by SQL statement. SQLWARN - is a warning variable that signals a potential problem. What is SUBSTR (substring)? SUBSTR function is used to extract substring of characters. SELECT SUBSTR (city(name of column), 2(starting position of the substring), 2(length of the substr). You can use substring in SELECT or WHERE clause. Subquery is a SELECT statement within parentheses (inner SELECT). search condition of an outer SELECTs, WHERE or HAVING clause. It can be used in the

Outer SELECT is a SELECT statement in which inner SELECT is embedded is the outer SELECT. Which SQL code is returned if subqueries which return multiple values follow comparison operators? -811. How does EXIST clause work? When EXIST is used in a Subquery DB2 evaluates that Subquery, but instead of passing the values to it, determines if it returns one or more rows. NOT EXIST is the opposite of EXIST. DB2 can be accessed: 1. Interactively - with: a. SPUFI (SQL Processing Using File Input) is a DSN command available from the DB2I panel which executes from an input data set and formats the results is an output sequential data set. b. and QMF (Query Management Facility) 2. From an Application program - embedded SQL0 - to code SQL statement in the body of Application program. Static SQL Is optimized before execution (access plan is selected before execution).

Embedded SQL - SQL statements that are embedded within an application program and are prepared during the program preparation process before the program executed. After it is prepared, the statement itself does not change (although values of host variables specified within the statement might change). Dynamic SQL - Is optimized at RUN time (QMF, SPUFI). We can use Dynamic SQL in Application program, when during execution the program can modify embedded SQL statements. If you using DELETE statement and not specify WHERE clause all rows from that table are deleted, unless WHERE CURRENT OF clause is specified. What is a Partitioned Tablespace and why would you use one? A Partitioned Tablespace is one that is divided at CREATE time into multiple partitions. A range of key values is assigned to each partition. Partitioned Tablespaces are particularly appropriate for large tables since each partition is a separate data set. Frequently used data can be placed on faster devices than infrequently used data. Also, certain utilities can be limited to partitions, saving utility time and allowing greater flexibility in scheduling. What do the BIND ISOLATION levels, CS and RR means? ISOLATION LEVEL applies to data that is read, not changed, with Logical Unit of Work. also applies only to page level locks, tablespace locks.

It

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna 1. Cursor Stability (CS) - indicates that a page lock is held only while a cursor is positioned on that page. Whenever a FETCH causes the cursor to move to another page, the current lock is released and a new lock acquired. 2. Repeatable Read (RR) - indicates that all page locks are held until the COMMIT or SYNCPOINT. The are other different types of page locks in DB2: Share (S), Update (U), and Exclusive (X). Describe some ways to improve concurrent access to your data. Use ISOLATION (CS) and LOCKSIZE PAGE. Evaluate Index subpages - more for UPDATE, less for - INSERT. Increase free space. Use clustering effectively. Pad rows to page length to force row-level locking. Partition data. Code to retry after a Deadlock or time-out. What does locking mean? Locking is a process that is used to ensure the integrity of data. It also prevents concurrent users from accessing inconsistent data. The data (row) is locked until a commit is executed to release the updated data. What is meant by lock escalation? Lock escalation is where the program starts with a page lock escalates to a table lock. Or tablespace in DB2 prior to version 2. What is the Isolation level on the Bind? Isolation level can be either RR - Repeatable Read, or CS - Cursor Stability. Cursor Stability releases share locks after cursor passes Repeatable Read holds the cursor until locks are released by a COMMIT statement. How can an end user be allowed to read some, but not all, columns on the table? Define a View that contains only those columns you wish the end user to read. Then GRANT SELECT on the View but not on the table. What is the difference between a searched update and a positioned update? a. A searched update can update one or more rows of data depending of whether the rows satisfy the search conditions written into the update statement. b. A positioned update updates the single row pointed to by the cursor named in the update statement. Can you use a positioned update when the cursor is pointing to a result table made of data from more than one table? No. A positioned update cannot operate on a read - only cursor, such as one where the results table is made with a JOIN. When can variable length columns cause performance problems? Variable length columns can cause performance problems when they updated. For example a long name replacing a short name in a full causes a row to be moved to a new page. Locating the new page to adjusting the Index requires CPU and I/O. What is a predicate? A predicate is an element of a search condition that expresses or implies a comparison operation: = - Equal =, <> - Not equal < - Less than > - Greater than <= - Less than or equal >= - Greater than or equal < - Not less than > - Not greater than What is a page? This is the unit of storage within a tablespace or Indexspace that is accessed by DB2.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna What is a data page? A data page is a unit of retrievable data, either 4K or 32K (depending on how the table is defined), containing user or catalog information. What is a pagespace? Pagespace refers either to an unpartitioned table, to an index space, or to a single partition of a partitioned table of index space. Utilities What is option Log with LOAD Utility? Log parameter determines whether log records are written for the inserted rows. Can be: LONG YES - default LOG NO - is more efficient, but will set tablespaces status to copy (copy pending flag is turned on). Name what will the COPY utility does? The COPY utility will create an image copy of a tablespace or a dataset within a tablespace. There are two types of image copies: full and incremental. A full image copy copies all pages in a tablespace or dataset. An incremental image copy copies only pages that have been modified since the last use of the COPY utility. When would you use an incremental COPY instead of a full COPY? When less than 1% of the pages in a large table are updated. Why do use RUNSTATS? RUNSTATS will scan tablespaces or indexes gathering information about utilization of space and efficiency of indexes. The information is stored in the DB2 catalog, and is used by the SQL optimizer to select access paths to data during the bind. What does the CHECK utility do? Reports inconsistency between Indexes and data. Reports violations relational constraints. Optionally deletes rows in violations referential constraints and copied them to an exception table. What will the REORG utility do? It will reorganize a tablespace to improve access performance and reorganize indexes so that they are more efficiently clustered. What does the RECOVER utility do? This utility recovers data to the current state or a previous state. The largest unit of data recovery is the tablespace; the smallest is a page. Data is recovered from image copies of a tablespace and database log change records. What does the REPAIR utility do? It will repair invalid data with valid data and/or reset status conditions. The data may be your own data or data you would not normally access: space map pages and index entries.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna

CICS
CICS is interface between application program and operating system. CICS is a table driven modular system. Table driven because all devices and resources are specified in CICS table. Task Initiation (Transaction flow) A Transaction is a redefined unit of work that a terminal user can invoke. Each transaction is identified by a unique 4 characters code called a Transaction identifier (TRANS-ID). Terminal Control Program (TCP) is constantly polling (count) all the terminals used in CICS region to see if the terminals are ready for the transaction. When operator enters the TRANS-ID, control will be passed to Storage Control Program (SCP) to create Terminal Input Output Area (TIOA), where information from the screen will be stored. Then Task Control Program (KCP) will take 4 characters (TRANS-ID) from TIOA and validate the TRANS-ID by searching the Program Control Program (PCP). If the TRANS-ID is not found in the PCT, KCP will pass control back to the TCP, which will display on error message Transaction invalid, please resubmit. If TRANS-ID is found in the PCT, the KCP will pass control to the PCP together with application program ID. PCP will search the Processing Program Table (PPT) to find out the location of the application program. If application program is not in the CICS region, the PCP will load the application program from the CICS load library in to CICS region. Fresh copy of WORKING-STORAGE and Task Control Area (TCA) will be created, usage counter in the PPT will be increased by 1 and control will be passed to the application program. The difference between command and macro level is that using macro level application program accesses CICS directly unlike using command level where application program is using an execute interface program to access CICS modules. What is a Start-Up Procedure? CICS region is defined through CICS Start-Up Procedure, which is a batch job and is used to bring the region up. Reentered Program is a program which can be reentered through multiple tasking, which means that when task regains control after interruption, it should be able to find the value of the file defined in the WORKING-STORAGE SECTION the same as before interruption. CICS allows quasi (almost) - reentrancy. It means that all users are sharing the same object code of the program only each user is given a fresh copy of the W-S area. So each user can use the W-S, which receives the data from the screen and where the data is formatted to be sent to the screen, in the normal way. How is program reentry accomplished in the CICS environment? Multiple tasks started with the same CICS TRANS-ID will have a separate copy of W-S and will share same copy of PROCEDURE DIVISION. Compiler Restrictions: COUNT, FLOW, STATE, ENDJOB, TEST, SYST, DYNAM, STXIT, SYSDUMP. Prohibited Sections: INPUT-OUTPUT, FILE. Prohibited Verbs: READ, WRITE, OPEN, CLOSE, ACCEPT, DISPLAY, TRACE, EXIBIT, UNSTRING. Prohibited COBOL Features: SORT, REPORT, WRITER, SEGMENTATION. CICS Tables: Terminal to have access to the CICS: TCT (Terminal Control Table) Each terminal will have its own control block. A control block is simply a piece of storage containing information. The control block for each terminal is called Terminal Control Table Terminal Entry (TCTTE) A TCTTE describes what device is and where it is addressed. It contains a pointer to the current Terminal I/O Area (TIOA). The TIOA resides in the Dynamic Storage Area (DSA), where all CICS work is processed. The TCTTE also contains a pointer to the Task Control Area (TCA) of the task attached to the terminal. If no task attached to the terminal, this terminal will contain zeros. Transaction IDs (TRANS-ID) to be used within CICS :

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna PCT (Processing Control Table) Contains a list of valid transaction identifiers (TRANS-ID). Each TRANS-ID is paired with the name of the program. entry per transaction defined. Program to be executed within the CICS: PPT (Processing Program Table) indicates each location). Not every directly with a transaction in programs that are the first to be loaded transaction are in the PCT.

One

Contains a list of all valid program names, also programs location (storage address, disk program in the PPT is associated the PCT. Only those for a particular

Files to be accessed within the CICS: FCT (File Control Table) Contains all files that belong to CICS (4 8 characters), along with the File Control Operation that may be requested for each file (READ, UPDATE, ADD, DELETE, etc.). One entry per file defined. If you are setting up a new file, you must request that a new FCT entry be created for it. All CICS tables are assembled and linked as executable modules by the system programming. CWA (Common Work Area) used generally for constants stored between tasks - it is permanent while CICS up. TWA (Task Work Area) is used as storage area associated with tasks. A TWA is attached to each task and goes away when task ends. What is the difference between CICS and Batch programs? 1. There is no ENVIRONMENT DIVISION in CICS. 2. Can not code STOP RUN in CICS program (it will bring CICS region down). 3. LINKAGE SECTION is a must in CICS program. 4. User has total control of the program execution in CICS. Task is execution of the transaction. Multithreading is execution of the same transaction at different terminals at the same time. Multitasking is execution of more than one task at the same time. Transaction is a way to request execution of a program or series of programs that are needed perform a task. Each execution of a transaction becomes a separate task, and is assigned a separate task number. Response time is a time needed for transaction to be processed. CICS Translator perform the following functions: 1. CICS Translator comments out every CICS command and replace it with MOVE and CALL statements to execute interface program. 2. CICS Translator will add a COPY statement for DFHEIVAR Block (Execute Interface Variable). 3. A LINKAGE SECTION will be added to the program and a COPY statement for EIB will be inserted there. 4. PROCEDURE DIVISION statements will be replaced as PROCEDURE DIVISION USING DFHEIBLK. There are 2 steps in order to compile your program: 1. PREPROCESSING (PRECOMPILER). 2. COMPILE. Any changes you make in your CICS program, you must have those 2 steps, because COBOL compiler does not understand: EXEC CICS or EXEC SQL. The purpose of the HANDLE CONDITION command is to prevent the ABEND of CICS task in case of exceptional error coding during execution of CICS command. Any combination of 12 options can be selected and coded in any order. The command creates GO TO environment. ERROR option is used to intercept any exceptional error condition except those specified in the corresponding HANDLE CONDITION command. How many different ways can you start (initialize) a CICS transaction? CICS transaction can be initiated in the following ways: 1. TRANS-ID is entered on the terminal. This is how you invoke a menu screen. 2. RETURN command with TRANS-ID option was executed . In CICS program that uses Pseudo-

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna Conversational programming, you need to issue this type of RETURN command after each SEND MAP command is issued. 3. TRIGGER-LEVEL is specified for Intrapartition destination of TD Queue When this . TRIGGER-LEVEL is reached a new CICS task with TRANS-ID specified for that destination in DCT (Destination Control Table) will be initiated. 4. The usage of the START command with TRANS-ID option. You can start a print utility transaction to print an On-line report. If you want to start the new transaction automatically issue RETURN with TRANSID (name) option. How to pass data with START command? 1. START FROM. 2. RETRIEVE INTO. BMS (Basic Mapping terminal control. 1. RECEIVE data 2. SEND data to Support) is an interface between the CICS application program and BMS commands consists of 2 basic functions: from a terminal. a terminal.

Define a Formatted data stream. BMS allows the program to be device independent and it translates Formatted data streams which enables the program to reference data by Symbolic labels. A Formatted data stream must contains at least an attribute. What is the difference between the ERASEUP option on the SEND MAP command and the terminal control command EXEC CICS ERASEUP END-EXEC? Both erase all the unprotected fields and sets them to low-values but the SEND MAP command allows attributes to be sent. The ERASEUP command: 1. Clears all MDTs 2. Unlock the keyboard 3. Erases all unprotected fields 4. Positions the cursor at the first unprotected field. When you are sending your first data screen to the terminal, it is recommended that you specify the ERASE option. Why? If you do not include the ERASE option, the screen size will be the same as the previous screen size setting and this may not be correct. There may also be material on the screen which would remain if not overlaid by fields of your map. ERASE erases whole map, its indicates that the screen is to be erased before the output map is displayed. Which BMS Macros do you know and what is the purpose of each one? Map definition is accomplished through the use of 3 different macro instructions: 1. DFHMSD - issued to describe the map set. MAPSET is 1 to 7 characters name (normally the PPT name corresponding to the map). The name must begin with alphabetic character and must be different from other map names or program names. TERM=TERMINAL TYPE - indicates the type of output device or logical unit associates with the map set. (3270, 3280, 4381) TYPE= - indicates the general function of the macro instruction. DSECT - indicates that this is a Symbolic description map. MAP - indicates that is a Physical map. &SYSPARM - indicates that the what type parameter is to be specified an assembly time through the PARM field in the JCL when submitted. FINAL - must be coded in the DFHMSD macro that marks the end of the map set. CTRL= - is used to specify device characteristics related to the terminals. FREEKB - specifies that the keyboard should be unlock after this map is written to the terminal. ALARM - activates alarm feature. FRSET - indicates that the MDT of all fields currently in the terminal buffer are to be reset to a not MODIFY condition. LANG= - specifies the language format for the Symbolic map. MODE= - specifies the type of Symbolic map to be generated. IN - indicates an input map only. OUT - indicates an output map only.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna INOUT - indicates both. TIOAPFX= - specifies whether BMS should include a filler in the Symbolic description map to allow for the unused TIOA prefix. YES - indicates that the filler should be in the Symbolic TIOA description. It should be coded in the map is to be used in a command level program. NO - the filler is not to be included. 2. DFHMDI - is used to describe the individual map. When defining more than one map within a map set, the corresponding number of DFHMDI macro instruction must be used. If the maps are for use an ANS COBOL program, they must be defined in the descending size sequence (the largest map first, the smallest map last). MAPNAME - is 1 to 7 characters name to be assigned to the map. This name may not be the same as the map set name specified on the DFHMSD. SIZE=(LINE,COLUMN) - specifies the dimension of the map in terms of length and width (value from 1 to 240). CTRL - may be used to override the CTRL specification made on DFHMSD macro. 3. DFHMDF - is used to describe the fields within a map. FIELD - is 1 to 7 characters name of the field to be used as a Symbolic reference to the field by the application program. POS=(LINE,COLUMN) - is used to specify the location within the map at which the field is to begin. LENGTH=- indicates the length of the screen (1 - 256) that being define. ATTRB= - is used to describe certain attributes of the individual screen field being defined. ASKIP - data cannot be keyed into the field and the cursor is to automatically skip over the field. PROT - similar to ASKIP, but cursor will not automatically skip over the field. UNPROT - data can be entered into the field. BRT - high intensity (bright). NORM - normal intensity. DRK - non display. NUM - causes the data entry keyboard to be set to numeric fields. IC - specifies that the cursor is to be placed in the first position of the field when the map is display. If more than one IC, the last specification will take procedure. FSET - specifies the MDT is to be set ON when the field is sent to the screen. INITIAL= - is used to specifies an initial value of the data field. The initial value must be enclosed within apostrophes ( ). PICIN= - specifies a COBOL picture string that defines the format of the data on input. Exp.: PICIN=999V99, the length defined by PICIN must agree with the length parameter. PICOUT= - specifies the format on output. Exp.: PICOUT=Z9.99, the length defined by PICOUT must agree with the length parameter. In order to change attribute character (highlight the field), we have to move just another value to attribute character of Symbolic Map: MOVE ATTRB-UNPROT-BRT TO CUSTNOA The purpose of the Stopper Filed is to limit the operator from entering extra data. Stopper Field should be defined as a 1 byte with ATTRIB=ASKIP. The default value for ATTRIB option if its not specified in DFHMDF Macro ATTRIB=ASKIP. MDT (Modified Data Tag) is the last bit of the attribute byte. by application program only when the MDT for that field is on. The field will be received

Can you list the cases when the application program can receive the field? The field received by the application program only when MDT for that field is ON. This take place in the following ways: 1. The field is entered or modified by the operator. In this case, MDT becomes ON and it will stay ON until the end of the screen session. 2. ATTRIB=FSET is specified for that field. What is the difference between FSET and FRSET? 1. ATTRIB=FSET can be specified on DFHMDF Macro and that will set the MDT for that field ON. 2. CTRL=FRSET can be specified on DFHMSD or DFHMDI, and will reset the MDT for all fields to OFF.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna Symbolic Map is produced when BMS Macros are assembled with TYPE=DSECT specified on the , DFHMSD Macro. Another words when your CICS program is compiled, it must include copy book in the W-S SECTION or LINKAGE SECTION. You will use this area as an I/O area for sending and receiving terminal data that pertains to certain fields. Symbolic Map is placed into the Copy Library and can be brought into the program with the following COPY or INCLUDE statement at compile or assembler time -- COPY label. Where label are the label used on the DFHMSD Macro. Each field within the Symbolic Map will be represented with the following statements: 1. Fields label from DFHMDF Macro + suffix L. (Length PIC S9(4) COMP). 2. Fields label from DFHMDF Macro + suffix A. (Attribute byte PIC X). 3. Fields label from DFHMDF Macro + suffix I. (The field itself). The Physical Map tells CICS how to format the map, and what constant fields should be displayed on the screen. Another word is describes the display format for a given terminal type. Each Physical Map is stored in the load library. The format of Physical Map includes: 1. Length of data fields. 2. Position of data fields on terminal. 3. Attributes of data fields. 4. Constants, headings. 5. Characteristics of the terminal. DATAONLY indicates that only data from Symbolic Map is to be used for Output. You use this option to save transmission of whole map. Also to save overhead of loading in map (similar to loading program) and merging it with data. MAPONLY indicates that only data from the Physical Map is to be used for Output. If nether MAPONLY or DATAONLY is specified, BMS will merge data from both to create the Output. MAPFAIL is an Exceptional error condition which can take place during execution of EXEC CICS RECEIVE MAP command. It takes place when no data is transmitted between the screen and the application program. It takes place in the following cases: 1. Operator pressed a CLEAR. 2. Operator did not entry any data. To prevent MAPFAIL condition on of the following can be done: 1. MAPFAIL condition should be specified in the HANDLE CONDITION command executed before RECEIVE command. 2. A field with LENGTH=1 and ATTRIB=(FSET,DRK) can be specified on the screen: DFHMDFPOS=(1,1), LENGTH=1, ATTRIB=(FSET,DRK) How can you access a record of the ESDS file in the CICS environment? RBA option should be specified in the READ command and RIDFLD should contain the Relative Byte Address of the desired record. How can you access a record of the RRDS file in the CICS environment? RRN option should be specified in the READ command and RIDFLD should contain the Relative Record Number of the desired record. How can access a record from the VSAM file, using Partial Key? GENERIC and KEYLENGTH option should be used for the READ command. How can CICS task Exclusive Control Interval be released? It could be done in the following ways: a. Execution of REWRITE command. b. Execution of DELETE command. c. Execution of UNLOCK command. d. Task termination (when you execute RETURN command). What is the difference between DUPKEY and DUPREC? 1. DUPKEY exceptional error condition can take place during execution of READ command and that would indicate that there are more duplicates for the Alternate Index.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna 2. DUPREC exceptional error condition can occur during execution of WRITE command and that would indicate that the program tries to add a record to the VSAM cluster where record with the same key already exists. How can you delete a group of records from the VSAM file? GENERIC and KEYLENGTH option should be specified for the DELETE command. NUMERIC option will indicate how many records were deleted. The purpose commands: 1. establishes 2. 3 4. 5. of browsing is to process VSAM file sequentially. Following are browsing STARTBR - This command indicates browsing operations and if successful, a current record pointer at the specific record of the VSAM file. READNEXT - Is used to browse file forward. READPREV - Is used to browse file backward. ENDBR - Terminates the browsing operation. (SYNCPOINT also ends the browse) RESETBR - Is equivalent to ENDBR and STARTBR.

How can you browse VSAM file starting from 1st record? MOVE low-value to RIDFLD (key) of the STARTBR (if key is alphanumeric, MOVE zeros to the key if numeric); specify option GENERIC with KEYLENGTH(0). How can you browse VSAM file starting from last record? MOVE high-value to RIDFLD (key) of the STARTBR (if key is numeric we have to redefine this field to allow move of high-value); and then issue READPREV. If we issue a READPREV command following a READNEXT command the same record is retrieved twice. Dont code a READPREV command right after a STARTBR command unless the STARTBR commands RIDFLD field contains high-value or program has a key of the record that exists on a file. We cannot use option GENERIC on STARTBR and READPREV commands. The default action for search type is GTEQ. If you specify EQUAL and no records are exist NOTFND exceptional condition is raised. What types of end-of-file are there? Physical - ENDFILE condition is raised when READNEXT or READPREV command is issued after the last record has been retrieved. Logical - Its occurs when program determines that o further sequential retrieved is required. Comparing the key of each record retrieved with same value can do this. HANDLE CONDITION for ENDFILE have to be specified in order not to occur. What option can be specified in a READNEXT or READPREV command that minimizes the amount of storage required for browse? SET option. Sequential Update program; it works in a way: - MOVE low-value to the key and STARTBR. - READNEXT until find a record which satisfies selection criteria and save the key of this record. - ENDBR. - Read this record for update. - REWRITE. - STARTBR from the saved key. - Continue browse until end of file. What is a String Number? String Number represents the number of concurrent (parallel) requests that could be executed by multiple tasks against VSAM file. System programmer can specify string number in FCT table for the file. Whenever FCP command is executed, one string is taken. Initiation of the browsing (STARTBR command) also takes one string thats why it is important to terminate the browsing as soon as possible. We have to use ENDBR to release STRING. Paging Paging refers to sequential scrolling backward or forward of the same data. There are couple of paging technique:

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna I. When we display data on the screen we have to save top and bottom keys in communication area and then if operator requests next page we use bottom key to STARTBR and READPREV, or if operator requests previous page we use top key to STARTBR and READPREV. II. On the way forward we save in temporary storage the whole map or record. On the way backward we use data from temporary storage to display on the screen . The purpose of Symbolic Cursor Position is to be able to override ATTRIB=IC option and to position the cursor under desired field. In order to accomplish Symbolic Cursor Position, the following should be done: 1. MOVE -1 TO the fields length in the Symbolic Map. 2. MOVE ATTRIB=UNPROT,BRT,FSET TO the fields attribute byte. 3. CURSOR option should be used for SEND MAP command without a displacement. The purpose of EXEC CICS ASKTIME command is to update EIBDATE and EIBTIME fields in Execute Interface Block (EIB). What is Execute Interface Block? It is inserted into Linkage translator and consists of the fields that describe the status of the mark and program execution. Some of the fields of EIB are initialize during task creation, others get updated during execution of specific CICS command. Can you name the fields from the EIB and tell when the fields get updated? The fields are as follows: a. EIBCPOSN - is indicated after execution of RECEIVE command. Contains the cursor address (position) associated with the terminal control or BMS input operation from a display device such as 3270. PIC S9(4). b. EIBDATE, EIBTIME - is updated at the time or date of task initiation and could be updated during execution EXEC CICS ASKTIME command. c. EIBTASKN - when CICS starts a new tasks, it will assign next sequential number to that task. PIC S9(7) COMP-3. d. EIBTRMID - this field is initiated at the same time of task creation, and contains the Terminal ID number. PIC X(4). e. EIBTRND - this field is initiated at the same time of task creation, and contains Transaction Identifier for your task. PIC X(4). f. EIBAID - this field initiated at the same time of task creation, and contains the Attention Identifier that came in with the most recent RECEIVE or RECEIVE MAP command executed in your program. PIC X(1). IF EIBAID NOT = DFHENTER GO TO ERROR-RTN. EXEC CICS HANDLE AID ANY KEY(ERROR-RTN) EXEC-CICS. The effect of this command will take place only after execution of RECEIVE command. g. EIBCALEN - this field contains the length of DFHCOMMAREA data that has been placed in your programs LINKAGE SECTION. If this field contains zero (0), there is no DFHCOMMAREA data. PIC S9(4) COMP. What are the CICS commands that can be used to transfer control from one program to another within the same task and what are the differences? 1. LINK - is transferring control to one logical level below, and always excepts RETURN command to get back. Programs that are using LINK programs are defined in PPT only. 2. XCTL - is transferring control at the same logical level. Programs that are using XCTL programs are defined in PPT and PCT. What is PGMIDERR? When does it take place? During execution of LINK and XCTL commands program ID error (PGMIDERR) - exceptional error condition could take place. That could happen whenever one of the following occurs: 1. PROGRAM-ID is not defined in the PPT table. 2. PROGRAM-ID is misspelled in the PPT table entry. Can we have RETURN with TRANSID inside of the subprogram called by the LINK command? No. Because RETURN command is supposed to return control to the next sequential instruction. LINK command calls subprogram which is one logical level below the main

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna program. After return is executed in the subprogram, control is passed to the next sequential instruction in the main program after the LINK statement. How many different ways can you find which key did the terminal operator press and which one is more efficient? EIBAID - field during task creation will be initiated to a certain value that will correspond to the key pressed. EXEC CICS HANDLE AID - could be used. The HANDLE AID command can be use to pass control to a specific label when a particular Attention Identifier is received. A maximum of 12 options may be specified in one HANDLE AID command. a. Any of the program attention keys (PA1 - PA3). b. Any program function keys (PF1 - PF24). Conversational programs is one that resides in memory the whole time and its carrying conversation with a terminal user. This method involves execution of SEND and RECEIVE command within the same task. Pseudo-Conversational method requires execution of RETURN command with TRANS-ID option after any SEND command. Also whether the program is executed 1st through 2nd time and so on (EIBCALEN=0). Can you describe the flow of control in the system during execution of the RETURN command with TRANS-ID option and COMMAREA option? The following events take place: 1. A copy of Comm Area will take place. 2. CICS TRANS-ID will be recorded in the TCT table for the terminal. 3. Current task will be terminated and resources related to it will be released. When terminal operator will press a key on the keyboard, a new task associated with the TRANS-ID recorded in the TCT table will be initiated, and a copy of Comm Area will be passed to the new task. DFHCOMMAREA coded in the LINKAGE SECTION could to be used to reference Comm Area copy. The purpose of the EXEC CICS IGNORE condition is to ignore exceptional error conditions. If exceptional error condition specified in the IGNORE condition command take place, those conditions will be ignored and task will continue its normal execution. An IGNORE command does not create a go - to environment, like HANDLE CONDITION does; instead, it gives control back to the next sequential instruction following the command causing the condition. How many different ways can you pass data between CICS program? 1. Communication Area can be used to pass data between programs of the same (LINK or XCTL commands) or different tasks (RETURN command with TRANS-ID option). 2. Temporary Storage Queue - in this case data can be passed between programs of the same tasks. 3. Transient Data Queue - whenever data is needed to be processed by CICS task as a sequential file. TD Queue is defined in the DCT (Destination Control Table). 4. CWA - data can be passed between programs of the same or different tasks. In this case, application program is usually not allowed to change or modify the data stored in this CWA area. 5. TWA - data can be passed between programs of the same task only. 6. TCTUA - data can be passed between programs of the same or different tasks, but executed at the same terminal. Describe the difference between Main and Auxiliary Temporary Storage? a. Main Temporary Storage causes no I/O and is not recoverable. b. Auxiliary Temporary Storage is recoverable but causes I/O. If Auxiliary Storage is used for TS Queue, then a VSAM KSDS file must be defined. Temporary Storage used in the following: a. Collect customer information and store in Temporary Storage Queue. b. Add records to the customer Master file by reading the Temporary Storage Queue. Temporary Storage Queue can contain 1 or more Temporary Storage records an is identified by a 8 character name which in most data center is combination of the 4 character terminal identification and 4 character transaction id.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna What is the function of the ITEM option when you try to add or to rewrite a Temporary Storage records? 1. To add - it will contain the number of the record just added. 2. To rewrite - it indicates the record to be replaced. How do you know when end of Temporary Storage Queue is reached? ITEMERR exceptional error condition will take place during execution of READQ TS command. What is the purpose of the Destination Control Table (DCT)? The DCT contains the names of all Queues and for Automatic Task Initiation, the TRIGGER LEVEL. Extrapartition Transient Data is a Sequential file that is available for to jobs running inside and outside the CICS region or partition. They can be on disk or tapes. Not recoverable. Intrapartition Transient Data is a Queue that is used for communication between programs within CICS partition or region. You can also use Intrapartition TD to accumulate the Online report using TRIGGER-LEVEL and printer ID as destination in the DCT. Recoverable. What is the difference between an Inrtapartition Transient Data Queue that is defined as reusable and one that is non-reusable? 1. Reusable: When a record is read from a reusable queue, it is removed physically from the queue. The storage or disk space is freed. 2. Non-reusable: When a record is read from a non-reusable queue, then it continues to take up storage or disc space although it still cannot be read more than once by any task. However, the advantage here is that a non-reusable queue may be defined as logically recoverable via Dynamic Transaction Backout . This means that the last record read can be once again made available if the task that previously read it ABENDed or was interrupted when CICS went down. This also means that records written to this queue during a failed task will removed. Describe Automatic Task Initiation? ATI is the process of initiating a task with no human intervention based on the accumulation of records. How do you determine the end of the Transient Data Queue? QZERO exceptional error condition will take place. Explain the difference between Temporary Storage and Transient Data? 1. Temporary Storage is for use only within CICS and cannot initiate a task. a. It creates dynamically, when you issue WRITEQ TS command. b. From Temporary Storage you can get records randomly and sequentially. c. There is no limit how many times you can read or update Temporary Storage. d. You can only delete the entire TS Queue, but not records individually. e. TS Queue must be unique. f. Used mostly to save previous display. 2. Transient Data (4 char.) can be used in or outside of CICS and can initiate a task. a. Transient Data Queue has to be specified in DCT (the parameters are TRIGGER LEVEL and TRANS-ID which will start a transaction). b. From Transient Data you get a records only sequentially. c. You can not update Transient Data Queue. d. Used mostly for Automatic Task Initiation (ATI). When debugging a CICS application, why would you use the CEBR command? To view the contents of the TSQ or TDQ. The Base locator for Linkage (BLL) mechanism is used to address storage outside the W-S SECTION of an application program. It operates by addressing the storage as if it were a parameter to the program. The storage must by coding of an 01-level data definition in the L.S. of the program. The COBOL compiler generates code to address the address the storage via the parameter list. When the program is invoked, CICS/VS sets up the parameter list in such a way that the parameter list is itself addressable by the application program. The parameter list must be defined as the first parameter to the program, (unless a communication area is being passed to the program, in which case the DFHCOMMAREA definition must precede it). If an area greater than 4096 bytes defined in the L.S., additional statement are required to establish addressability to the extra

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna area. An additional BLL cell is required for each 4096 bytes or part added to the area. An ADD statement is required also for each extra 4096 bytes or part; it is placed after the statement that establishes addressability to the data area. Example: LINKAGE SECTION. 01 PARMLIST. 02 FILE-PTR PIC S9(8) COMP. 02 FILE-PTR-2 PIC S9(8) COMP. ----PROCEDURE DIVISION. ----EXEC CICS ...... END-EXEC. SET (FILE-PTR) ADD 4096 TO FILE-PTR GIVING FILE-PTR-2. What is the difference between Locate and Move mode? a. If the command is process in the Locate mode, a SET option should be used during the execution of command, data is read into buffer, address of that buffer is placed into L.S. and data is processed outside of the program. Example: WORKING-STORAGE SECTION. 01 TEST-KEY PIC X. 01 REC-LENGTH PIC S9(4) COMP. LINKAGE SECTION. 01 BLL-CELLS. 05 FILLER PIC S9(8) COMP. 05 FILE-BLL PIC S9(8) COMP. 01 TEST-REC. 05 TEST-FIELD1 PIC X. 05 TEST-FIELD2 PIC X. PROCEDURE DIVISION. EXEC CICS READ DATASET (TESTDATA) SET (FILE-BLL) RIDFLD (TEST-KEY) LENGTH (REG-LENGTH) END-EXEC. b. If the CICS command is executed in the Move mode, INTO option should be used, data is read into input buffer, then from buffer data is moved into W-S SECTION and processed there. Example: WORKING-STORAGE SECTION. 01 TEST-REC. 05 TEST-FIELD1 PIC X. 05 TEST-FIELD2 PIC X. 05 REC-LENGTH PIC S9(4) COMP. 05 TEST-KEY PIC X. LINKAGE SECTION. PROCEDURE DIVISION. EXEC CICS READ DATASET (TESTDATA) INTO (TEST-REC) RIDFLD (TEST-KEY) LENGTH (REG-LENGTH) END-EXEC. Locate mode is more efficient because the actual size of the program is smaller and the response time is faster, but in Move mode the data is more safe. Command like READ, READNEXT, READPREV, RECEIVE can be executed in Locate and Move mode. How many different ways can you determine that the CWA, TWA or TCTUA areas exist? 1. Usage of ADDRESS command. 2. Usage of ASSIGN command. How can you prevent CICS task from abending? To prevent the first condition occurring we use HANDLE CONDITION command. If we want to prevent the second condition from occurring we can use HANDLE ABEND command. Example: EXEC CICS HANDLE ABEND option(name) option END-EXEC. Where option(name) can be: a. program(program-name) control should be transferred to another program.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna b. label(paragraph-name) control should be passed to the paragraph within the same program. c. CANCEL - which means the effect of a previously coded HANDLE ABEND should be canceled (this is the default). RESET - which means a previously canceled HANDLE ABEND, should be reestablished. RESP option on CICS command. We must define a binary Fullword item in W-S, then we name this field on the RESP option on CICS command. CICS places a numeric value in the response code field after execution of CICS command. What is the difference between HANDLE CONDITION and RESP? 1. We have to specify HANDLE CONDITION command before issue the command itself. If condition that isnt specifically listed in HANDLE CONDITION command is raised CICS Abends program. 2. We test RESP code after issue CICS command. With response code checking CICS never Abends a program because it doesnt know in advance which conditions you want to handle in the program. Option RESP overrides HANDLE CONDITION. What command is used to stop the execution of the task? EXEC CICS ABEND. If the dump requested - EXEC CICS ABEND ABCODE (XXXX) ---> 1-4 char. identifying the dump provided by CICS/VS. What is the purpose of Service Reload? If an application program is to be compiled using the features of the OS/VS COBOL or DOS/VS COBOL compilers, the special compiler control statement ( Service Reload) must be inserted following any changes to the contents of BLL. Which CICS transaction Abends do you know and how to determine them? All CICS transaction Abend codes are 4 characters alphanumeric codes with the following format, AxxY, where: A - constant A, identifies the abend as being CICS generated. xx - 2 character code including the CICS module in which the abend was detected; For example: BM - basic mapping. FC - file control. IC - internal control. JC - journal control. KC - task control. PC - program control. SC - storage control. TC - terminal control. TD - transient data. TS - temporary storage. Y - one character code assigned by CICS. The following are several common CICS abend codes, along with there description: ASRA - The task has been abnormally terminated because of a program interrupt (like data exception - OC1, OC4, OC7). APCT - A requested module cannot be located in the PPT or the entry is disabled or the module has zero length. APCP - An abnormal completion of an I/O event has been detected while attempting to load a program. AICA - A runaway task condition has been detected which indicates a possible logical loop within the users program. ABMO - Requested BMS could not be found (wrong name on SEND or RECEIVED command). LUW (Logical Unit of Work) is work done by task between 2 SYNCPOINT. DTB stands for Dynamic Transaction Backout. If DTB=YES is specified in PCT, Dynamic log will be allocated for that transaction during its execution. If the resource processed by that task is defined as Recoverable DTB processing would be processed backward against VSAM files at the time of the abend and all changes of that file would be reversed. The purpose of the SYNCPOINT command is to split long running task into smaller LUW. this case work done by the task before last SYNCPOINT will be saved on the resource. In

PDF created with pdfFactory trial version www.pdffactory.com

How many different ways SYNCPOINT could be created?

R.Ramakrishna Explicit - through usage of EXEC CICS SYNCPOINT command (done by the program). Implicit - whenever task for which DTB=YES is specified in the PCT table entry, is initiates or terminated (done by CICS). ROLLBACK is an option of SYNCPOINT command and when that option is specified all the changes done to Recoverable Resource during the last LUW will be reversed. The Flight Task is a task that started and did not finish when system abend took place. Dynamic log is allocated to the transaction if DTC=YES is specified in PCT table. It will be used to Backout changes done to Recoverable Resources in case of task abend. System log is used to Backout changes done to Recoverable Resources by in Flight Tasks in case of system abend. How can you bring a new copy of the program into the CICS region? 1. CSMT and CEMT transaction could be executed. 2. CNTL=NEW,PROG=xxxx. (Use of INTERTEST) What are the some of the most common operations you can perform with the CEMT CICS transaction? 1. Create a new copy of an application program - CEMT S PR(prgname) NEW. 2. Close a file from CICS - CEMT S DA(filename) CLO UNE. 3. Disable a transaction - CEMT S TRANS(transid) Dis.

How can you test a CICS command without program execution? CECI transaction could be used. What is the function of the CEDA transaction? It is used to perform the Resource Definition On-line operation (RDO). and changes table entries.

It adds, deletes,

What is a Deadly Embraced mean? When 2 tasks are each waiting for the resource that the other is holding. To avoid 2 tasks from falling into a Deadly Embrace one of the following should be done: 1. The files and records accessed by multiple tasks should be processed by those tasks in the same order. 2. A task should release exclusive control of the record as soon as possible. In On-line environment, how can you prevent more than one user from accessing the same Transient Data Queue? By issuing an EXEC CICS ENQ against the resource. When processing is completed. a DEQ should be executed. How can the usage of the resources be scheduled? ENQ and DEQ commands can be used. Resource name is not defined anywhere, but programs have to work in team and use the same name of resource. All programs which can cause Deadly Embrace situation have to use ENQ and DEQ commands, otherwise if at least one will not have it, ENQ and DEQ will not work. What is Communication Area (Comm Area)? Every CICS/VS program must include a LINKAGE SECTION. At minimum this section includes 2 areas. The EIB (Automatically inserted by the translator) and a Communication Area, the DFHCOMMAREA. The Communication Area consists of 2 data area which are coded in the program: 1. The first area appears in the WORKING-STORAGE SECTION and is used for sending data to another program. This is simply a data area where data to be passed to another module is stored. 2. The second area is coded in the LINKAGE SECTION. This area should be defined with a 01-level statement, must be spelled DFHCOMMAREA and must be coded as the first entry in the LINKAGE SECTION and used for receive data. Specific entry logic must always be coded at the beginning of the program in order for Pseudo-Conversational programming to work. The EIBCALEN field in the EIB reflects the length of the data passed to the current program via the Communication Area. If Comm Area is not being passed, EIBCALEN will be set to zero (0). By testing EIBCALEN for a value of zero, you can determine whether it is the first execution of the program. You also can check for TRANS-ID.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna Maximum size of passing data is 32K. In order to send a message on the screen we have to move message to message output MOVE xxxx TO MSG To clear to error message field we have to move spaces to that field. MASSINSERT option of ascending order from MASSINSERT operation VSAM files only. It for high performance WRITE command, which allows multiple records to be written in the same work area. is writing more than one record at the same time, it can be used for will ends with END command or EXEC CICS UNLOCK command. It also used and optional placement of records in VSAM cluster.

GETMAIN is used to obtain an extra storage outside of program FREEMAIN command would be use after the storage had been used.

(To release page buffer)

What is INTERTEST? INTERTEST is a special package, which allows you to test your programs on-line by the breakpoints that you set up yourself. While using INTERTEST it is possible to see contents of your W-S in characters and HEX. It has 4 basic commands: FILE Allows you to browse the contents of the file. CORE Allows you to browse and change the contents of W-S fields. CNTL Allows you to set up the breakpoints on your programs so that during program execution the program will stop at that statement displaying the part of procedure division where the program was stopped by the breakpoint. LIST To list the procedure division if your program and allows you to set up the breakpoints (easier to use than CNTL). CEDF invokes a debugging aid and called Execute Diagnostic Facility. With CEDF we can check the completion of each CICS command examine and change WORKING-STORAGE with PF5 key. What kind of CICS restart procedure do you know? Cold-restart Starting CICS initially from the beginning (usually in the morning all CICS tables are in there initial status). Warm-restart Starting CICS from a particular pint. All CICS tables will be reinitialized to predetermination status. Emergency-restart -Starting CICS during the emergency (after the systems down). What CICS command do you need to obtain the user logon-id? You must code EXEC CICS ASSIGN with the OPERID option. Explain the term MRO MRO (Multi-Region Operation) is the mechanism by which different CICS address space (region) within the same CPU can communicate and share resources. What are 3 reasons why a program may already be in the storage? 1. It is a resident program (loaded when CICS management module). 2. Another task is using the program. 3. Another task used the program, storage areas was not needed and program remained in storage. What is Usage Counter? Field in PPT entry. PCP has to know if there any tasks currently using the same program. Each time a task starts using program, Usage Counter is increased. When Usage Counter = 0, PCP authorizes the use of the area occupied by program. To logon in to CICS region use CSSN. To logoff from CICS region use CSSF or if you want to be out completely just add LOGOFF.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna

IDMS
IDMS is an acronym that stands for Integrated Database Management System. What is the difference between an OBTAIN and a GET? 1. GET commands IDMS to move the data contents of a database record from the IDMS buffer pool into a programs working storage. The record must first have been retrieved by IDMS. FIND does that. 2. OBTAIN simply performs the FIND and the GET in one operation. What does an OBTAIN ANY do? This is so obscure (unclear) that it is almost a trick questions. another way to say OBTAIN CALC.

OBTAIN ANY is simply

What does OBTAIN DUPLICATE do? OBTAIN DUPLICATE pertains (relate to) CALC records only when defined with duplicates allowed. Once a program OBTAINS a CALC record, OBTAIN DUPLICATE will retrieve the first duplicate. What does the IF SET EMPTY IDMS command do? It checks the current owner of the specified set to see if there are any members records. What does the IF SET MEMBER IDMS command do? It checks the current member of the specified set in the command to see if it participates in the set or not. Looking at it from a programmers point of view, what do you like most about IDMS? Some DBMSs require commands to be coded directly in CALL program statements. One must then debug them one call at a time. IDMS allows one to write database commands using program statement similar to the native language, be it COBOL or PL/I, so coding it is easier. IDMS also provides a precompiler that checks the whole program for syntax and semantics, validating all of the IDMS code in one pass before testing starts. What is the difference between a CV batch and a DC batch program? A CV batch program only uses regular IDMS databases. A DC batch program is an IDMS batch program that can use additional IDMS/DC functions including the Scratch and Queue facilities. What method can be employed during system and program design to avoid database record deadlocks? Make a list of all the records in the Schema. Place the records in a sequence designed to minimize record - locking bottlenecks. When writing programs, always lock the database records in the sequence in which they appear on the list. How can you avoid having to check the IDMS error - status field after IDMS DML command? Write the program using an autostatus protocol. How does an IDMS application program communicate with the IDMS DBMS? It communicates by calling the IDMS Application Program Interface using standard subroutine linkage and passing parameters. For some IDMS commands, the program must move a value into one or more fields within the Subschema Control Block. For example, the DIRECT-DBKEY field must be set to STORE of a DIRECT record. How does IDMS communicate with an application program? IDMS has several avenues. Exceptional condition codes are usually sent back in the ERRORSTATUS or LR-STATUS field of the Subschema Control Block. ERROR-STATUS, ERROR-RECORD, and ERROR-AREA fields may communicate the name of an object in error. The contents of IDMS records are returned to a program in the IDMS record data structures (01 levels) within the DATA DIVISION. Of course, if IDMS hits great difficulty and cant proceed, it will simply abort the program setting the user ABEND code.

What is an Area sweep? When a program reads all of the pages within an Area in sequence from first to last, that is called an Area sweep.

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna Describe the IDMS statement that a simple program would contain if its whole purpose were to STORE a CUSTOMER record in an IDMS database. The program must be coded to: 1. Specify the name of the Subschema it will use. Optionally, it may also specify the Schema name and version, database name, database node, dictionary name, and dictionary node. 2. COPY from dictionary the record definition for the CUSTOMER record. This places the record 01 level definition in W-S. 3. BIND the RUN-UNIT to establish the run - time connection to IDMS. 4. READY for UPDATE the IDMS Area in which the CUSTOMER record is stored. 5. Once the CUSTOMER record data fields are populated issue the STORE CUSTOMER command. 6. Check ERROR-STATUS for zeros. 7. Issue FINISH to commit the CUSTOMER record to the database file. The ERRORSTATUS field must also be checked after the BIND, READY, and FINISH to make sure they also worked. Why doesnt the program check the ERROR-STATUS after the Subschema defines and COPY? Those are checked by the IDMS precompiler with appropriate action taken at that time. They cause no actions at program execution time. What is the SYSIDMS file used for? SYSIDMS is a new file in the Release 12.0 batch IDMS interface. It is used to activate numerous run - time option such as local versus central version mode, journaling versus No - journaling, DMCL name, DBNAME, and so forth. How can one avoid adding a SYSIDMS file to all of their batch jobs when running in Release 12.0 or later? That may not be possible. If you want to take advantage of some of the special run - time options, such as database tracing or QSAM support, a SYSIDMS file is needed to input the option parameter cards. However, if there are no special requirements, using IDMSDMCL for the batch DMCL will make the SYSIDMS file unnecessary. What is QSAM support and why is it used? For non-VSAM database file, IDMS uses BDAM to access database pages. With BDAM, IDMS must wait while a read is in progress. However, when doing an Area sweep, QSAM can be used instead. With QSAM support, the processing for one database page overlaps reading of the next page in an Area. This serves to reduce the program elapsed time. What common database programming mistake to beginners make when coding the Area sweep of owner records combined with set processing of each owners members? They dont reestablish area currency on the proper owner occurrence prior to OBTAIN NEXT WITHIN AREA. How do you improve performance of a batch job that will read every record in one Area if its running in local mode? In Release 10.2, link-edit the IDMSQSAM driver into the program. In Release 12.0, put the QSAM option in the SYSIDMS file. When searching for several member records in succession be symbolic key on a chained sorted set, how can you prevent IDMS from starting each search from the beginning of the set? Sort the search symbolic keys in the same sequence as the member records in the set and specify the CURRENT option on the OBTAIN NEXT RECORD IN THE USING command. How does IDMS know when an Area is locked? Record locks are kept inside of the Central Version (CV) only. CV locks a record by putting the records DB-Key into the list of locked records. Any DB-Key in the list identifies a record as being locked. Regarding the attributes of IDMS sets, explain what Mandatory, Optional, Automatic, and Manual mean? Automatic and Manual define the actions IDMS takes when storing a member record on a set. Automatic means the record is automatically connected to the set. Manual means that it is not. Connection, in that case, must be done with a CONNETCT IDMS command. Mandatory and Optional define the actions a program may command for a record already connected to a set. Optional indicates that the record may be removed from the set by a DISCONNECT in an update program. One could say: Continued participation in the set is

PDF created with pdfFactory trial version www.pdffactory.com

R.Ramakrishna optional. Mandatory indicates that disconnection is not allowed. One could say: Continued participation in the set is mandatory. Then, only erasing the record will remove it from the set. What is a logically deleted record? A logically deleted record occurs when IDMS cannot completely delete all of a database record one tells it to ERASE. This occurs only when erasing a record that is a member of a chain set with no PRIOR pointers and when the run-unit has not established any currency on the prior record in the set. When erasing a member record, IDMS always requires access to the sets PRIOR record so that its NEXT pointer can be modified to point past the record being erased. If IDMS cant do that, then at least the data portion of the database record is removed. But the record prefix containing all set pointers must remain to keep the chain intact. How can logically deleted records be avoided? The easiest way is to always specify PRIOR pointers for every chained set. For a set without prior pointers, always establish set currency on the member record prior to the one being erased immediately before the erasure. How can logically deleted records be dealt with? One can simply leave them there, not dealing with them at all. IDMS will also ignore them, although they do take up space and add overhead to internal set processing. One can write an update program that reads each owner and then each member of each problem set, setting up the conditions that allow the logically deleted record to be removed. One can run the IDMSDUMP utility with the LDEL option, followed by the IDMSLDEL utility. Perhaps the best action is to restructure the set(s) that have logically deleted records to include PRIOR pointers. Unfortunately, since restructure cannot process a database containing logically deleted records, they still have to be cleaned up first. What happens when a program ERASES a record from an IDMS database? IDMS attempts to disconnect the record from each set in which it participates. If that is successful, the record is effectively erased when IDMS sets its line index to null. If the record was the highest- numbered record on the page, the line index is returned to the unused area on the page instead. If IDMS cannot disconnect the record from every set, then the data portion is released and just the prefix remains. It is marked as a logically deleted record. What happens when a program ERASES a record from an IDMS database? IDMS attempts to disconnect the record from each set in which it participates. If that successful, the record is effectively erased when IDMS sets its line index to null. If the record was the highest-numbered record on the page, he line index is returned to the unused area on the page instead. If IDMS

IMS
What are the parameters needed for an IMS call (Command-Level Interface)? Call CBLTDLI USING function DB-PCB IO-AREA SSA(s). Do you always need every parameter? Which ones dont you need, and why? No. You dont need SSAs on a DLET, REPL, or unqualified GU.

PDF created with pdfFactory trial version www.pdffactory.com

You might also like