Mainframe Fundas

This is a Open Forum for all Mainframe Developers to discuss about different MF Funda which will make work easier along with the Solutions to different MF related Issues.

 
Other Helpful Links
1.MainFrameForum.com
2.MvsForum.com
3.MainFrameIndiaForumm.com
My Favorite Sites
1.MainFrame.com
2.MainframeBooks.com
3.MainFrame Week.com
Interesting Topics
  • Catalog procedure Vs In-Stream procedure?
  • Dynamic Vs Static Call in Cobol
  • GDG
  • IEBGENER, IEBCOPY and REPRO in IDCAMS
  • Searching a Member
  • Searching a member
  • Dos Key in Mainframe
  • Create or Replace a member
  • Recovery of changes in Mainframe
  • Tablespace & DB2 Key
  • New Topics
  • Catalog procedure Vs In-Stream procedure?
  • Dynamic Vs Static Call in Cobol
  • GDG
  • IEBGENER, IEBCOPY and REPRO in IDCAMS
  • Searching a Member
  • Searching a member
  • Dos Key in Mainframe
  • Create or Replace a member
  • Recovery of changes in Mainframe
  • Tablespace & DB2 Key
  • Credits
    Thanks & Regards
    Satya...
    Catalog procedure Vs In-Stream procedure?
    Saturday, August 7, 2010
    Question: What is the difference between catalog procedure and In-Stream procedure?
    Answer: In Stream procedures are set of JCL statements written between JOB and EXEC statements, start with PROC and end with PEND statement. Mainly used to test catalog procedures. Cataloged procedure is cataloged on the procedure library and is called by specifying the procedure name on the EXEC statement.
    posted by satya @ 11:48 AM   0 comments
    Dynamic Vs Static Call in Cobol
    Question: What is the difference between a DYNAMIC and STATIC call in COBOL?
    Answer: To correct an earlier answer: All called modules cannot run standalone if they require program varibles passed to them via the LINKAGE section. DYNAMICally called modules are those that are not bound with the calling program at link edit time (IEWL for IBM) and so are loaded from the program library (joblib or steplib) associated with the job. For DYNAMIC calling of a module the DYNAM compiler option must be choosen, else the linkage editor will not generate an executable as it will expect ull address resolution of all called modules. A STATICally called module is one that is bound with the calling module at link edit, and therefore becomes part of the executable load module.
    posted by satya @ 11:47 AM   0 comments
    GDG
    Question: What is a GDG?
    Answer: GDG - group of dataset that are logically or chronologically related, referred by name and a relative generation number - an integer which identifies the generation of a dataset and is coded in parentheses after dataset name. Absolute GDG name - GxxxxVyy, where xxxx-absolute gen.number, yy-version number. Can be sequential, direct, partitioned. (VSAM - no). Must always be cataloged. Advantage - all datasets have the same name and system keeps track of adding new and retaining previous generations and deleting oldest successive generation. To create a GDG we create a GDG index in the system catalog with IDCAMS utility and then a model (prototype, DSCB) on the same volume to supply DCB information. Empty - when limit is reached all members are removed from the index, otherwise-only oldest. Scratch-removed members are uncataloged & deleted, otherwise - removed & uncataloged, but remain in the system (not members of GDG any more). GDG number is updated at the end of the job. If number is not specified all generations will be processed from the beginning
    posted by satya @ 11:45 AM   0 comments
    IEBGENER, IEBCOPY and REPRO in IDCAMS

    Question: What is the difference between IEBGENER, IEBCOPY and REPRO in IDCAMS

    utlity?

    Answer: IEBGENER -- This is a dataset utility for copying sequential datasets which produces a PDS or a member from a sequential dataset.

    IEBCOPY -- This is a dataset utility for copying one PDS to another or to merge PDSs.

    REPRO -- This is for copying sequential datasets.

    posted by satya @ 11:42 AM   0 comments
    Searching a Member
    Sunday, May 25, 2008
    Searching a member in PDS only by its middle name
    I have a PDS and I want to search it for member only by middle string of the members. e.g. there are some members like BESTJCL1,RESTJCL2,PESTCBL1, BESTCBL2, WESTCBL3,TESTASM1,BESTASM2...etc I want to find members which have CBL in them. How can I search and find these members? Use ISPF 4.12 option. Specify the dataset to be searched and the pattern of the string. Specify the LANG type as COB And select the browse option.
    posted by satya @ 11:25 PM   0 comments
    Searching a member
    Searching a member
    In Mainframes if you do not know the PDS name to which a particular member belongs use the following method.If u want to search “” and if u think it is listed in some PDS beginning with XYZ
    1 Start 3.4 XYZ.**This will list all the PDS starting with XYZ
    2 Type “Member ” on command lineMember is a keyword.This will immediately point out the PDS in which required member is located.
    posted by satya @ 11:22 PM   0 comments
    Dos Key in Mainframe
    Doskey
    In Mainframes, to use the previously executed commands (SIMILAR TO DOSKEY IN DOS) use shift+F12.
    posted by satya @ 11:21 PM   0 comments
    Create or Replace a member
    Tuesday, May 20, 2008
    Create or Replace a member
    Sometimes you have made changes in view mode but if you want to save mainframe will not allow as it is in view mode. but below are the commands which can create/replace a member in view mode also.
    To create or replace a member type ‘create .zf .zl ’/‘replace .zf .zl
    posted by satya @ 10:33 PM   0 comments
    Recovery of changes in Mainframe
    Recovery of changes
    You can undo changes in mainframe by giving 'recovery on' or 'rec on' followed by ‘undo’ command on the command line. You can keep doing undo till the last saved value.
    posted by satya @ 10:31 PM   0 comments
    Tablespace & DB2 Key
    1.1 Cancel utility holding the table space
    -TERM UTILITY(XXXX43.XXXXX43A)
    1.2 Force starting Test database
    -START DATABASE(XXXX01) SPACENAM(XXXX20) ACCESS(FORCE)
    1.3 Query to find Key of a DB2 table
    SELECT *
    FROM SYSIBM.SYSCOLUMNS
    WHERE TBNAME = 'CDM_CRD_MEM_UNASGN'
    AND KEYSEQ > 0
    ORDER BY KEYSEQ
    posted by satya @ 10:28 PM   0 comments
    Common Abend Codes in Jobs
    Saturday, May 17, 2008
    Common Abend Codes in Jobs.
    1. S001 - An I/O error occurred. Check reason code for exact cause. Examples are trying to read beyond End of File, trying to write to an input file or a file length error.
    2. S0CA - The result of an arithmetic operation was too large for the receiving field.
    a). An attempt was made to divide by too small of a number.
    b). An attempt was made to multiply by too large of a number.
    c). A program loop containing an arithmetic instruction caused an invalid result.
    3. S0CB - An invalid divide was attempted.
    a. The divisor was zero. b. The quotient exceeded the allowed data field size.
    4. S0C1 - The current machine instruction was invalid
    (This can be caused due to Operation Exception.Check for subscript errors, missing DD card, file not opened)
    Some other common cause:
    a. A JCL DD statement was either invalid or missing.
    b. An attempt was made to open a data set which was already open.
    c. A read/write was attempted to an unopened data set.
    d. An attempt was made to execute a subroutine which was not link edited into the load module.
    e. The select clause was invalid for an vsam data set.
    5. S0C2 -- The current machine instruction was invalid.
    a. A JCL DD statement was either invalid or missing.
    b. An attempt was made to open a data set that was already open.
    c. A read/write was attempted to an unopened data set.
    d. The select clause in the file-control paragraph did not specify an index sequential data set, when in fact the data set was indexed sequential.
    e. A subscript or index contained an invalid value.
    6 S002 - Invalid I/O record, e.g. attempting to write a record that is longer than the maximum record length
    7 S004 - Error occurred during OPEN. E.g. Invalid DCB.
    8. S013 - Error OPENing a dataset, e.g. PDS member does not exist, record length in program doesn’t match dataset’s record length.
    9.S0C4 - Protection Exception/Storage Violation. Trying to access storage not available to the program. Can be caused by a subscripting error or reading/writing a file that isn’t open.
    10.SOC5 -An invalid address was specified.Common causes for this kind of abend is as follows :
    a. A close statement was issued twice for the same file.
    b. A procedure which was operated on by a Perform statement contained an improper exit.
    c. An attempt was made to reference an input/output area, but no open or read had occurred for the data set.
    d. A subscript or index contained an invalid value.
    e. A JCL DD statement was either invalid or missing.
    f. The blocksize and record size were specified as equal for variable length records.
    g. An attempt was made to read/write an unopened data set.
    h. An attempt was made to read after end-of-file.
    i. A stop run occurred before all opened data sets were closed, in the input or output procedure of a sort.
    j. Invalid parameters were passed through the linkage section.
    k. The file-control select clause was missing for the data set that was being processed.
    11. SOC6 - An attempt was made to execute a machine instruction which had invalid operands.
    a. The program fields and/or data sets were incorrectly defined.
    b. A multiplier or divisor was too large.
    c. A subscript or index contained an invalid value.
    d. A JCL DD statement was either invalid or missing.
    e. The block size and record size were specified as equal for variable length records.
    f. An attempt was made read/write to an unopened data set.
    g. An attempt was made to read after end-of-file.
    h. 1. Stop run occurred before all opened data sets were closed.
    2. In the input or output procedure of a sort
    i. An attempt was made to reference an input/output area, but no open or read
    had occurred for the data set
    j. Invalid parameters were passed through the linkage section.
    k. The file-control select clause was missing for the data set that was being processed.
    12. S0C7 - Program Check Exception - Data. Check for spaces
    in a packed decimal or numeric field. Check to see if
    record layouts or file layouts have been changed.
    13. S0C8 - The result of an arithmetic operation was too large for the
    receiving field.
    a. An attempt was made to divide by too small of a number.
    b. An attempt was made to multiply by too large of a number.
    c. A program loop containing an arithmetic instruction caused an invalid result
    14. S0C9 - A division gave a quotient which was too large for the program defined field.
    a. An attempt was made to divide by zero.
    b. An attempt was made to divide by too small of a number.
    c. A program loop containing an arithmetic instruction caused an invalid result.
    d. A sort operation was missing a SORTIN or SORTOUT JCL DD card.
    15. Sx22 - Job has been cancelled. The value of x will vary depending on the way the job was cancelled.
    16. S222 - Means job was cancelled by a user or operator without a dump.
    17. S522- If a TSO session times out you will probably get an S522 abend code.
    18. S322 –Job or step time exceeded the specified limit OR program is in loop OR insufficient time parameter on job or exec card.
    19. S806 - Unable Link or Load. The job was unable to find the specified load module. Check that the job is looking at the correct Load Libraries, specify a STEPLIB if required.
    20. S80A -Not enough Virtual Storage to satisfy a GETMAIN or FREEMAIN request.
    21. S822 -Unable to obtain to obtain enough space to satisfy a RE.G.ION= request May need to change RE.G.ION statement in the JCL.
    22. S878 - Not enough storage available to satisfy a GETMAIN or FREEMAIN request. Job was unable to allocate an area of memory of the correct size. Try Specifying or amending the ‘REGION=’ JCL statement.
    23. S913 - You are trying to access a dataset which you are not authorized to use.
    24. Sx37 - Unable to allocate enough storage for a dataset. You might need to increase the amount of primary and secondary space to be allocated for a dataset in the ‘SPACE=’ parameter, or you may have to move the dataset to a different DASD device which has enough space to store the dataset. ‘x’ will vary, likely Abends are SB37, SD37 or SE37.
    25. S837 – Caused due to space issue .
    Resolved after adding this following Line in the JCL
    Space=( CYL,(1400,100),ELSE)
    26.S9F7 –Caused due to access denial to a specific
    NID.(User restriction)
    27. S000u0010 –Invalid PDS record length.
    posted by satya @ 10:34 AM   0 comments
    PDS in Use
    PDS in Use
    While trying to open any member in a PDS, we sometimes come across "member in use" message. In that situation, if you want to know who is using the member currently,
    press F1 twice.
    posted by satya @ 10:33 AM   0 comments
    Warping of Data in a Dataset
    Warping of Data in a Dataset
    Lets have a dataset of length 120. For some reasons, you want to wrap the data in each record to 60 characters and have the next 60 characters in the next line.
    1. Open the dataset.
    2. In the first line, issue the line command: TF60 (60 chars per line).
    3. All the subsequent lines will wrap to 60 chars per line.
    posted by satya @ 10:19 AM   0 comments
    Table space scans, non-matching index scans, etc.
    Thursday, May 15, 2008
    Table space scans, non-matching index scans, etc.
    All WHERE clauses should include predicates for indexed columns and "stage 1" predicates (db2) should be provided.
    Do not begin predicates with '%' in a LIKE function
    Avoid using "not equal" as a comparison operator unless other predicates are stage 1 and indexable.
    Do not use arithmetic calculations as the right operand in an expression. Set a variable to the result before execution.
    posted by satya @ 7:36 PM   0 comments
    Excessive locking and lack of concurrency
    Excessive locking and lack of concurrency
    Batch update jobs processing large amounts of data will need to have restart logic through the use of the COMMIT statement and a program data save area. This will identify the restart point. Commit frequency should be an input parameter where possible, and not hard coded in the program. See the following points to make a program Restart able:
    a) declare 2 cursors to select rows to be updated in the table. Code an order by clause for the columns of the unique index. The firsr cursor will select the rows we want.
    e.g.
    Table for Restart is
    CREATE TABLE CHKPT_RSTRT
    ( PROGRAM_NAME CHAR(8) NOT NULL,
    ITERATION CHAR(4) NOT NULL,
    COMMIT_FREQUENCY SMALLINT NOT NULL WITH DEFAULT,
    NO_OF_COMMITS SMALLINT NOT NULL WITH DEFAULT,
    CHECKPOINT_TIME TIMESTAMP NOT NULL WITH DEFAULT,
    CHECKPOINT_AREA CHAR(254) NOT NULL WITH DEFAULT,
    PRIMARY KEY (PROGRAM_NAME,ITERATION)
    )
    IN DATABASE.TABLE
    ;
    CREATE UNIQUE INDEX XCHKPRST
    (PROGRAM_NAME,ITERATION)
    CLUSTER
    ;

    QUERY

    EXEC SQL
    DECLARE PBNPRLV_CSR1 CURSOR FOR
    SELECT
    CNTRL_NO,
    BPRO_NO,
    BNPRLV_NO,
    PBNH_EFF_DT
    FROM PBNPRLV
    ORDER BY CNTRL_NO,BPRO_NO, PBNH_EFF_DT
    END-EXEC.
    The second cursor is for use after issuing commits and restart processing. We have to reposition the cursor by using where clause that reflect the order by on the primary key.
    EXEC SQL
    DECLARE PBNPRLV_CSR1 CURSOR FOR
    SELECT
    CNTRL_NO,
    BPRO_NO,
    BNPRLV_NO,
    PBNH_EFF_DT
    FROM PBNPRLV
    WHERE
    ((CNTRL_NO= :CHKPT-CNTRL-NO
    AND BPRO_NO = :CHKPT-BPRO-NO
    AND PBNH_EFF_DT> :CHKPT- PBNH-EFF-DT)
    OR (CNTRL_NO = :CHKPT-CNTRL-NO
    AND BPRO_NO > :CHKPT-BPRO-NO )
    OR (CNTRL_NO > : CHKPT-CNTRL-NO))
    AND CNTRL_NO >= : CHKPT-CNTRL-NO
    ORDER BY CNTRL_NO, BPRO_NO, PBNH_EFF_DT
    END-EXEC.

    b) select the row from CHKPT-RESTRT table for the program and iteration being processed.
    c) If it is the first time through and CHECKPOINT_AREA contains data, the program is restarted. Move appropriate values from CHECKPOINT_AREA to host variable used in second cursor and open it.
    d) Fetch the row from the opened cursor.
    e) If fetch is successful increment the WS variable that counts successful fetches.
    f) Perform UPDATE for PBNPRLV row that was fetched.
    g) If the fetch counter is equals to the COMMIT_FREQUENCY, perform a commit paragraph. This paragraph should increment and Update NO_OF_COMMITS and CHECKPOINT_AREA column with data retrieved from table and set CHECKPOINT_TIME to current time stamp and issue a COMMIT and reset the fetch counter to zero.
    h) After commit the cursor will be closed unless WITH HOLD option specified.
    i) When update processing is complete, reset the values of the columns in the CHKPT_RSTRT table to their original default value.
    posted by satya @ 7:30 PM   0 comments
    DSNTIAR Use
    DSNTIAR
    We can use the DSNTIAR subroutine to convert an SQLCODE into a text message. The syntax is
    CALL 'DSNTIAR' USING SQLCA ERROR-MESSAGE ERROR-TEXT-LEN.
    We did a search in MPROD2 for C37BAT31 (Batch COBOL) and the modules that use DSNTIAR are in the attached list. After calling DSNTIAR we get the system text message in array ERROR-MESSAGE for SQLCODE in SQLCA.
    Let’s say the WORKING STORAGE variables defined for DSNTIAR are
    01 WS010-MISC-FIELDS.
    05 WS010-SQLCODE PIC +9(05).
    05 WS010-MSG-LINE PIC X(120) VALUE SPACES.
    05 WS010-SUBSCRIPT PIC 9(02) VALUE ZERO.
    05 WS010-TEXT-LENGTH PIC S9(9) COMP VALUE +120.
    05 WS010-DB2-ERROR-MESSAGE.
    10 WS010-MSG-LENGTH PIC S9(4) COMP VALUE +960.
    10 WS010-MSG-TEXT PIC X(120) OCCURS 8 TIMES.

    The code for calling DSNTIAR is
    CALL 'DSNTIAR' USING SQLCA,
    WS010-DB2-ERROR-MESSAGE,
    WS010-TEXT-LENGTH
    The code for displaying error message returned by DSNTIAR is
    PERFORM VARYING WS010-SUBSCRIPT
    FROM 1 BY 1
    UNTIL WS010-SUBSCRIPT > 8
    IF WS010-MSG-TEXT (WS010-SUBSCRIPT) > SPACES
    DISPLAY WS010-MSG-TEXT (WS010-SUBSCRIPT)
    END-IF
    END-PERFORM.
    After calling DSNTIAR we have to call ‘CEE3ABD’ or ‘ABEND’ to stop processing in side DB2 handler or Application Programming Interface(API).
    posted by satya @ 7:26 PM   0 comments
    Some Tips for DB2
    Utilization of dynamic SQL
    While this has it's advantages, it cannot be administered via a DBA. Also, with some technologies, excessive catalog locking conflicts with DBA activity. Utilize this in reporting only environments where absolutely necessary. Provide an easy method to capture SQL and possibly EXPLAIN the access paths. If not reporting, use Stored Procedures or APIs.

    Host variable
    Many times, a variable not correctly defined will lead to errors that are difficult to detect. Where appropriate, use DCLGEN variables produced from the system catalog.

    LOCK TABLE or DDL in program
    These cause issues with concurrency. Avoid these unless the DDL is for Declared Temporary Tables.

    Call the DBA with vague DB2 error
    INCLUDE the SQLCA. Use appropriate error code logic after each SQL call. Provide all the error information given by calling the DSNTIAR program or using GET DIAGNOSTICS (V8) or using Java methods that provide detailed information
    posted by satya @ 7:23 PM   0 comments
    Numeric to Varchar
    Wednesday, May 14, 2008
    Moving a numeric constant to the length field of a VARCHAR data type
    Causes the row to be excessively large wasting DASD and causing extraneous I/Os.
    EXEC SQL
    SET: calc-length =
    LENGTH(RTRIM(:host-var))
    END-EXEC
    MOVE calc-length TO LL-field (in Cobol 49 level)
    posted by satya @ 9:37 PM   0 comments
    Cursor Declaration options
    Options on DECLARE CURSOR
    ∙ Use FOR READ/FETCH ONLY or WITH UR for retrieval only cursors.
    ∙ Use OPTIMIZE when you know the accurate number of rows that will be fetched
    ∙ Use ORDER BY only when sequence is important
    ∙ Use WITH HOLD statement to prevent COMMIT from destroying the cursor position in batch Programs.
    ∙ Select only those fields that you truly need
    ∙ Use only DCLGEN variables as predicates
    While declaring CURSOR in handler we should use OPTIMIZE FOR n ROWS, if we want pass only n rows from DB2 handler back to calling program. In this case DB2 handler only fetches n rows into the intermediate result table. The syntax is

    DECLARE C1 CURSOR FOR
    SELECT * FROM PACS_TRANS_TRACK
    OPTIMIZE FOR 5000 ROWS
    FOR FETCH ONLY

    OPTIMIZE FOR tells DB2 to proceed under the assumption that at most a total of integer rows are to be retrieved from the result table. Without this clause, DB2 would assume that all rows of the result table are to be retrieved, and would optimize accordingly. Optimizing for integer rows, if at most this number of rows are fetched, could improve performance.


    E.g.
    We want to fetch PRCTR_CD, CTLHX_NM, and CTLHX_EFF_DT from CTLHX table with the descending order of CTLHX_EFF_DT.

    EXEC SQL
    DECLARE CTLHX_CSR CURSOR FOR
    SELECT
    PRCTR_CD,
    CTLHX_NM,
    CTLHX_EFF_DT
    FROM CTLHX
    WHERE
    CNTRL_NO =: CNTRL-NO
    AND CTLHX_SUPRCD_DTS ='0001-01-01-00.00.00.000000'
    AND CTLHX_EFF_DT <=: CTLHX-EFF-DT
    ORDER BY CTLHX_EFF_DT DESC
    FETCH FIRST 1 ROW ONLY
    WITH UR
    END-EXEC

    As this is retrieval only so we have used WITH UR option. Here the order is important so we used ORDER BY clause. As if we use DCLGEN variables. As we are interested in retrieving the first row so we have used the clause FETCH FIRST 1 ROW ONLY clause. We have used literal '0001-01-01-00.00.00.000000' so that optimizer will know at BIND time the values.
    posted by satya @ 9:36 PM   0 comments
    Performance Enhancement by Null Indicator
    No Null indicators values nor coalesce.
    For all Columns that can contain Nulls, indicator variable should be used in all Select Statements -or- the COALESCE built-in function should be used.

    E.g.

    Let us define and cursor TQ_CSR

    EXEC SQL
    DECLARE TQ_CSR CURSOR FOR
    SELECT TQ_UOWPRR_DESC
    ,TQ_UOWPRIOR_ID
    ,TQ_PRRACTVTY_DT
    ,TQ_MIGRATION_DT
    ,TQ_DELETION_IND
    FROM TQ1
    WHERE TSQRY_PRODSGMT_CD = :TSQRY-PRODSGMT-CD
    AND TSQRY_CLNTSGMT_CD = :TSQRY-CLNTSGMT-CD
    AND TQ_REC_ID = :TQ-REC-ID
    AND TQ_TPPREFIX_CD = :TQ-TPPREFIX-CD

    END-EXEC.


    EXEC SQL
    FETCH TQ_CSR
    INTO :TQ-UOWPRR-DESC:IND-UOWPRR-DESC,
    :TQ-UOWPRIOR-ID:IND-UOWPRIOR-ID,
    :TQ-PRRACTVTY-DT:IND-PRRACTVTY-DT,
    :TQ-MIGRATION-DT:IND-MIGRATION-DT,
    :TQ-DELETION-IND:IND-DELETION-IND
    END-EXEC.



    The purposes of the indicator variable are to:
    1) Specify the null value. A negative value of the indicator variable specifies the null value. A value of -2 indicates a numeric conversion or arithmetic expression error occurred in deriving the result
    2) Record the original length of a truncated string (if the source of the value is not a large object type)
    3) Record the seconds portion of a time if the time is truncated on assignment to a host variable.
    For example, if :TQ-UOWPRR-DESC:IND-UOWPRR-DESC is used to specify an insert or update value, and if IND-UOWPRR-DESC is negative, the value specified is the null value. If IND-UOWPRR-DESC is not negative the value specified is the value of TQ-UOWPRR-DESC.

    Similarly, if :TQ-UOWPRR-DESC:IND-UOWPRR-DESC is specified in a VALUES INTO clause or in a FETCH or SELECT INTO statement, and if the value returned is null, TQ-UOWPRR-DESC is not changed and IND-UOWPRR-DESC is set to a negative value. If the value returned is not null, that value is assigned to TQ-UOWPRR-DESC and IND-UOWPRR-DESC is set to zero (unless the assignment to TQ-UOWPRR-DESC requires string truncation of a non-LOB string; in which case IND-UOWPRR-DESC is set to the original length of the string). If an assignment requires truncation of the seconds part of a time, IND-UOWPRR-DESC is set to the number of seconds.
    posted by satya @ 9:34 PM   0 comments
    Performance enhancement of Cobol Db2
    Minimize Cursor Use
    Cursors force the database engine to repeatedly fetch rows, negotiate blocking, manage locks, and transmit results. Use forward-only and read-only cursors unless you need to update tables. More locks may be used than are needed, and there is an impact on the temp db database. The impact varies according to the type of cursor used.

    The forward-only, read-only cursor is the fastest and least resource-intensive way to get data from the server. This type of cursor is also known as a firehouse cursor or a local fast-forward cursor. If you feel that you really need to use a cursor, learn more about the different types of cursors, their locking, and their impact on the tempdb database.

    Often, cursors are used to perform a function row by row. If there is a primary key on a table, you can usually write a WHILE loop to do the same work without incurring the overhead of a cursor.
    posted by satya @ 9:32 PM   0 comments
    PL1 Oncode List
    Monday, May 12, 2008
    ONCODE meaning of the ONCODE
    3 in a SELECT/WHEN/OTHERWISE group, no WHEN clause satisfies the condition and no OTHERWISE clause is given
    4 SIGNAL FINISH, STOP or EXIT statement executed
    9 SIGNAL ERROR statement executed
    10 SIGNAL NAME statement executed or NAME condition occurred
    20 SIGNAL RECORD statement executed
    21 Record variable smaller than record size
    22 Record variable larger than record size
    23 Record variable length is zero or is too short to contain the key
    24 a record with a length of zero was read from a REGIONAL data set
    40 SIGNAL TRANSMIT statement executed.
    41 transmission error in output data set
    42 transmission error in input data set
    43 transmission error on output to VSAM index set
    44 transmission error on input from VSAM index set
    45 transmission error on output to VSAM sequence set
    46 transmission error on input from VSAM sequence set
    50 SIGNAL KEY statement executed
    51 specified key can not be found
    52 specified key already exists
    53 key is out of sequence during creation of a INDEXED or REGIONAL data set
    54 key conversion error
    55 either the specified key is the null string or begins with X'FF' or a REWRITE was attempted but the embedded key has changed
    56 key is outside of the data set limits
    57 No space available to insert a record
    58 key is outside of range
    70 SIGNAL ENDFILE statement executed or ENDFILE condition occurred
    80 SIGNAL UNDEFINEDFILE statement executed
    81 conflicting attributes between DECLARE statement and OPEN statement
    82 Conflict between file attributes and physical organization of data set
    83 data set specification is incomplete
    84 DD statement is missing in JCL
    85 an I/O error occurred during initialization of DIRECT OUTPUT file
    86 LINESIZE greater than maximum
    87 conflicting attributes between DECLARE statement and JCL DD statement
    88 conflicting attributes between DECLARE statement and JCL DD statement
    89 password not specified or invalid
    90 SIGNAL ENDPAGE statement executed or ENDPAGE condition occurred
    91 ENV() option invalid for file accessing VSAM data set.
    92 error while opening a VSAM data set
    93 error while opening a data set (subcodes)
    94 REUSE specified, but data set is not reusable
    95 Alternate index specified for an empty VSAM data set.
    96 Attempt to OPEN the MSGFILE(SYSPRINT) file after a subtask has been created
    99 open failed for dataset (subcodes)
    100 SIGNAL PENDING statement executed or PENDING condition occurred
    150 SIGNAL STRINGSIZE statement executed or STRINGSIZE condition occurred
    151 truncation occurred while assigning a mixed-character string
    290 SIGNAL INVALIDOP statement executed or INVALIDOP condition occured
    300 SIGNAL OVERFLOW statement executed or OVERFLOW condition occurred
    310 SIGNAL FIXEDOVERFLOW statement executed or FIXEDOVERFLOW condition occurred
    320 SIGNAL ZERODIVIDE statement executed or ZERODIVIDE condition occurred
    330 SIGNAL UNDERFLOW statement executed or UNDERFLOW condition occurred
    340 SIGNAL SIZE statement executed or SIZE condition occured
    341 SIZE condition occured during I/O operation
    350 SIGNAL STRINGRANGE statement executed or STRINGRANGE condition occurred
    360 insufficient free storage for allocation of a based variable
    361 insufficient space in target area for assignment of source area
    362 SIGNAL AREA statement executed
    400 SIGNAL ATTENTION statement executed or ATTENTION condition occurred
    450 SIGNAL STORAGE statement executed
    451 ALLOCATE failed, not enough storage available
    500 SIGNAL CONDITION (name) statement executed
    510 SIGNAL CHECK statement executed
    520 SIGNAL SUBSCRIPTRANGE statement executed, or SUBSCRIPTRANGE condition occured
    521 subscript of iSUB-defined variable lies outside bounds of corresponding dimension of base variable
    600 SIGNAL CONVERSION statement executed
    601-684 Invalid conversion attempted during input/output of a character string.
    1002 GET or PUT STRING specifies data exceeding size of string
    1003 output not allowed due to previously raised TRANSMIT or KEY condition
    1004 PAGE, LINE or SKIP attempted for nonprint file.
    1005 DISPLAY() REPLY () statement uses zero length expression
    1007 REWRITE or a DELETE statement not preceded by a READ statement
    1008 invalid data for a GET STRING DATA statement.
    1009 I/O statement conflicts with the file attributes
    1010 BUILTIN funcion or pseudovariable references a file, which is not open
    1011 I/O error with no more information provided by OS
    1012 READ SET or READ INTO statement not preceded by a REWRITE statement
    1013 REWRITE or DELETE statement can not be executed as the preceding READ statement has not yet completed
    1014 number of incomplete operations reaches maximum
    1015 event variable for an input/output operation is already in use.
    1016 file is not open due to an UNDEFINEDFILE condition
    1018 EOF encountered in data before end of data-list or format-list
    1019 attempt to close file not opened in current task
    1020 I/O attempted before WAIT statement executed to ensure completion of previous READ
    1021 record can not be accessed as it is locked by another file in this task
    1022 unable to extend VSAM data set
    1023 file closed but records still locked by a subtask
    1024 sequence of I/O operations on device-associated file is incorrect
    1025 Insufficient virtual storage available for VSAM to complete request
    1026 no position established in VSAM data set
    1027 Record or VSAM control interval already held in exclusive control
    1028 volume not mounted
    1029 repositioning failed in VSAM data set
    1030 error occurred during index upgrade on a VSAM data set
    1031 invalid sequential write attempted on VSAM data set
    1040 no more space available for output data set
    1041 record contains a record-delimiter
    1042 record contains an invalid record-delimiter
    1102 storage management failed to free storage as the adress of the storage to be freed was invalid
    1104 internal error in a library
    1105 "object window" couldn't be created
    1500-2531 computational error while executing a builtin-function
    2002 WAIT statement cannot be executed because of restricted system facility (checkout or optimizing compiler only)
    2050 WAIT statement would cause a permanent wait
    3000 edit directed I/O would lead to a loss of significant digits or sign
    3001 value of W field in F format specification too small
    3006 PIC description of target does not match source
    3009 mixed-character string contains a shift-out but no shift-in
    3010 mixed-character string contains invalid data
    3011 MPSTR built-in function contains invalid character
    3012 retry for graphic conversion error not allowed.
    3013 graphic string is too long
    3014 graphic or mixed string does not conform to the continuation rules
    3015 X or GX constant has an invalid number of digits
    3016 Improper use of graphic data in stream I/O
    3017 Invalid graphic, mixed, or DBCS continuation when writing stream I/O to a file containing fixed-length records
    3500 error during execution of a WAIT-statement
    3501 error during execution of a DETACH-statement
    3502 error during execution of an ATTACH-statement
    3503 error during execution of a STOP-statement
    3797 attempt to convert to or from graphic data
    3798 ONCHAR or ONSOURCE pseudovariable used out of context
    3799 ON-unit was entered due to a CONVERSION condition and the character that caused the condition is used but has not been corrected by use of the ONSOURCE or ONCHAR pseudovariables.
    3800 length of data aggregate exceeds system limit
    3801 Array structure element not mapped
    3808 Aggregate cannot be mapped in COBOL or FORTRAN
    3809 data aggregate exceeded the maximum length
    3810 extent of an array exceeds maximum
    3901 task variable is already used
    3904 COMPLETION pseudovariable specifies an event variable that is already in use
    3906 assignment to an event variable that is already active
    3907 DISPLAY statement specifies an event variable that is already active
    3909 insufficient main storage available to create subtask ( using CALL statement )
    3910 maximum number of subtasks reached
    3911 WAIT statement in ON-unit references an event variable already being waited for
    3912 CALL with TASK option in block invoked while executing PUT FILE(SYSPRINT) statement
    3913 CALL statement with TASK option specifies an unknown entry point
    3914 FORTRAN or COBOL already invoked by an other task
    3915 multitasking library not selected in the link-edit step
    3920 An out-of-storage abend occurred
    3951 OpenEdition callable service BPX1MPI failed
    3952 OpenEdition callable service BPX1MP failed
    3953 OpenEdition callable service BPX1PTB failed
    4001 CONTROLLED variable not allocated during GET DATA
    4002 CONTROLLED-Variable not allocated during PUT DATA
    4003 CONTROLLED-Variable not allocated during PUT DATA with STRING-option
    8091 operation exception ( machine instruction code is invalid )
    8092 privileged operation exception ( a priviledged instruction cannot be executed in "problem program state" )
    8093 EXECUTE exception ( an EXECUTE instruction must not target itself )
    8094 protection exception ( address translation error or storage protected )
    8095 addressing exception ( address lies outside the available virtual storage )
    8096 specification exception
    8097 data exception ( decimal packed value is invalid )
    8098 not enough stack-storage ( result of a fixed-point operation is too large )
    8099 fixed point divide exception ( result of a fixed-point division is too large - division by zero ? )
    9002 GOTO statement references label in an inactive block
    9003 label of the GOTO statement does not exist
    9050 program terminated by an abend
    9051 error occured in CICS ( adress of a parameter might be invalid )
    9200 program check in SORT/MERGE program
    9201 VM does not support SORT (if enterprise compiler: CMS does not support SORT)
    9202 RECORD TYPE is missing in PLISRTx-call
    9203 RECORD TYPE is invalid in PLISRTx-call
    9204 specification of "LENGTH=" is missing in PLISRTB- or PLISRTD-call
    9205 specification of "LENGTH=" is not numeric in PLISRTB- or PLISRTD-call
    9206 E15 oder E35 routine returns an invalid return-code
    9207 DFSORT failed ( check separate messages )
    9208 PLISRTx invoked, but environment is not ADMVS
    9249 routine cannot be RELEASEd
    9250 procedure to be fetched cannot be found
    9251 transmission error during fetch of a procedure
    9252 FETCH/RELEASE not supported in VM (if enterprise compiler: FETCH/RELEASE not supported in CMS)
    9253 debugging tool not available ( if enterprise compiler: PLITEST not available )
    9254 a MAIN procedure from a PL/I routine can not be fetched under CICS
    9255 attempt to release a load module containing a high-level language program, which is not PL/1
    9257 attempt to fetch a subroutine using the PLICALLA entry point
    9999 invocation of an Language Environment for MVS/VM service failed
    posted by satya @ 3:45 PM   2 comments
    Mainframe Funda - 25
    Thursday, May 8, 2008
    Performance Improvement:
    Pointers:
    POINTER is one of the data type in COBOL. A variable defined as data type POINTER can store the memory address of the other variables used in the program. There are different ways in which we can use POINTER variables in our program to achieve different tasks. One such example is retrieving data from “Linked list” or “Chained list”, the way data is being stored in IDMS. POINTER variables are used for passing/sharing memory address across modules through COMMAREA in CICS. The reason why POINTER is used for sharing memory address across modules through COMMAREA in CICS is as follows
    1) In CICS, one program can call an another program using three methods which are CALL(COBOL CALL), LINK(CICS), XCTL(CICS). There are various reasons why LINK, XCTL is preferred in CICS compared to CALL. One such reason is ‘A CALLed program remains in its last-used state after it returns control, so a second CALL finds the program in this state. LINK and XCTL commands, on the other hand, always find the "new" program in its initial state’. LINK always passes the control back to calling module, whereas XCTL doesn’t return the control back to calling module. CALL always passes the control back to the calling module.
    2) The basic difference between the CALL and LINK, XCTL is the syntax and how the data is passed between modules. Now if we look at the syntax of all three then it would look like
    CALL USING [BY REFERENCE / BY CONTENT] identifier-1 identifier-2
    EXEC CICS LINK PROGRAM(program-name) COMMAREA(commarea) LENGTH(length) END-EXEC
    EXEC CICS XCTL PROGRAM(program-name) COMMAREA(commarea) LENGTH(length) END-EXEC
    3) The basic difference between above three structure is, CALL can use any number of variables (of course within compiler limit) to pass from calling to called module. Again when ever we are doing a CALL BY REFERENCE only the reference or address of the memory location of the variable is passed to called module. But this not the case with LINK, XCTL. With LINK, XCTL there is no concept of CALL BY REFERENCE or CALL BY CONTENT. With LINK, XCTL we can pass only COMMAREA from one module to another. Called module can update the contents of COMMAREA. But COMMAREA has limited size. But what should we do if we want to store large size arrays in COMMAREA. Again COMMAREA is common to all programs for a transaction. An array used by two modules might not be used by all modules under the transaction. So how to use the COMMAREA in an optimal manner.
    4) To resolve the above question we can use POINTER concept, the concept of CALL BY REFERENCE, the concept of passing REFERENCE of identifiers. Suppose we want to pass REFERENCE OF array WS-DATA-ARRAY from one module to another. In stead of putting entire WS-DATA-ARRAY in COMMAREA, we use the concept of CALL BY REFERENCE. Get the address of WS-DATA-ARRAY in a POINTER variable. Store the POINTER variable in COMMAREA. Pass the COMMAREA to called module through LINK or XCTL (In fact to any subsequent programs executed, as COMMAREA is visible to all modules under the transaction). Called module use the POINTER variable to locate the exact memory location and its data for further processing.
    5) So in this case, POINTER variable is used, because we don’t have any concept like CALL BY REFERENCE or CALL BY CONTENT in case of LINK, XCTL. The data present in COMMAREA can be passed to called module only. Again contents of COMMAREA are visible across multiple pseudo transactions. Hence to use COMMAREA in optimal manner, as size of COMMAREA is limited, POINTER are used to store address of memory locations (need to be accessed in called module) in COMMAREA.
    6) But in batch in case of CALL BY REFERENCE we are already passing POINTER or REFERENCE or address of memory locations to be shared. This is taken cared by compiler itself. The REFERENCE is being passed through some SPECIAL REGISTER in case of CALL BY REFERENCE. This SPECIAL REGISTER solve the purpose of COMMAREA as explained above in this context. Hence in batch we can safely go ahead without usage of POINTER.
    e.g.
    Suppose in the main program P1VEDAT1 we have used the pointer STDRULE-PTR to call the program P1VEDSR2 then the syntax for this is as below
    P1VEDAT1

    01 WS-POINTERS.
    05 STDRULE-PTR POINTER VALUE NULL.

    Z1000-CALL-DB2-PBTE-RULE-PARA.
    MOVE 'Z1000' TO WS01-PARA-NO
    SET STDRULE-PTR TO ADDRESS OF ST-RECORD
    CALL K-P1VEDSR2 USING STDRULE-PTR
    FUNCTION-CODE
    SET STDRULE-PTR TO ADDRESS OF ST-RECORD
    IF ( PLAN-FATAL-ERR OF ST-RECORD )
    SET WS-FATAL-ERR TO TRUE
    PERFORM W1000-ERR-ST-RECORD
    END-IF
    .

    P1VEDSR2

    LINKAGE SECTION.
    01 LS-STDRULE-PTR POINTER.

    PROCEDURE DIVISION USING LS-STDRULE-PTR

    SET ADDRESS OF ST-RECORD TO LS-STDRULE-PTR
    MOVE ZERO TO PLAN-SQLCODE
    EVALUATE LS-FUNCTION-CODE
    WHEN 'S'
    WHEN 'I'
    PERFORM S1000-SELECT-PARA
    WHEN 'A'
    PERFORM A1000-ADD-PARA
    WHEN 'C'
    PERFORM U1000-UPDATE-PARA
    WHEN 'D'
    PERFORM D1000-DELETE-PARA
    WHEN OTHER
    SET PLAN-FATAL-ERR TO TRUE
    MOVE WS-PBTE-RULE-TABLE TO PLAN-DB2-TBL-NME
    MOVE WS-P1VEDSR2 TO PLAN-PROGRAM
    MOVE WS05-INVALID-FUNC-ERR TO WS05-ERR-MESSAGE
    MOVE WS05-ERR-MESSAGE TO PLAN-ERR-MESSAGE
    END-EVALUATE.
    posted by satya @ 9:28 PM   0 comments
    Mainframe Funda - 24
    Tuesday, May 6, 2008
    Performance Improvement:
    OCCURS DEPENDING ON

    When using OCCURS DEPENDING ON data items, ensure that the OCCURS DEPENDING ON objects are binary (COMP) to avoid unnecessary conversions each time the variable-length items are referenced. Some performance degradation is expected when using ODO data items since special code must be executed every time a variable-length data item is referenced.

    E.g.

    Working-storage section
    01 WS-M1VEH52Q-PL-DB2-RET-TBL-2.
    05 WS-BIC-TBL-LEN PIC S9(04) COMP.
    05 WS-PL-BIC-SEARCH-ENTRIES OCCURS 1 TO 200 TIMES
    DEPENDING ON WS-BIC-TBL-LEN
    INDEXED BY WS-BIC-INDX.
    10 WS-PL-BIC-SRCH-BIC PIC X(05).
    10 WS-PL-SRCH-PROV PIC S9(04) COMP.
    10 WS-PL-PROV-START-VAL PIC S9(04) COMP.
    10 WS-PL-PROV-STOP-VAL PIC S9(04) COMP.

    A0000-MAIN-PARA.
    PERFORM C0000-PL-INTEGRATION-PARA
    VARYING WS-BIC-SUB FROM +1 BY +1
    UNTIL WS-BIC-SUB > BIC-SEQ-CTR OF BC-BIC-TABLE
    ******************************************************************
    *THIS PARAGRAPH CHECKS WHETHER THE BICS IN THE BC-BIC-TABLE *
    *ARE PRESENT IN THE RETURN-TABLE-2. AND IF PRESENT IT GETS THE *
    *CORRESPONDING PROVISION FOR THAT BIC. *
    ******************************************************************

    C0000-PL-INTEGRATION-PARA.

    SET WS-BIC-INDX TO WS-STORE-POS

    MOVE BIC OF BC-BIC-ENTRY(WS-BIC-SUB) TO WS-DED-PLN-LIM-BIC
    PERFORM
    VARYING WS-BIC-INDX FROM WS-STORE-POS BY +1
    UNTIL ( WS-BIC-INDX > WS-BIC-TBL-LEN )
    OR
    (WS-PL-BIC-SRCH-BIC (WS-BIC-INDX) > WS-DED-PLN-LIM-BIC)

    IF ( WS-PL-BIC-SRCH-BIC (WS-BIC-INDX)= WS-DED-PLN-LIM-BIC )
    PERFORM C1000-GET-PROV-LINE-PARA THRU C1000-EXIT
    END-IF
    END-PERFORM

    SET WS-STORE-POS TO WS-BIC-INDX
    .
    C0000-EXIT.
    EXIT
    .

    ******************************************************************
    * THIS PARAGRAPH POPULATES THE RETURN TABLE 2 *
    ******************************************************************

    C5000-POPULATE-RTN-TBL-2.

    ADD +1 TO WS-POSITION
    WS-BIC-TBL-LEN
    MOVE WS-BIC-EX-BIC(EX-INDX) TO WS-LAST-STORED-BIC
    LS-PL-BIC-SRCH-BIC (WS-POSITION)
    MOVE WS-BIC-EX-LINE-PROV(EX-INDX)
    TO WS-LAST-STORED-PROV
    LS-PL-BIC-SRCH-LINE-PROV (WS-POSITION)
    MOVE WS-COUNTER TO
    LS-PL-PROV-START-VAL (WS-POSITION)
    posted by satya @ 10:35 PM   0 comments
    Mainframe Funda - 23
    Performance Improvement:
    Indexes vs Subscripts

    Using indexes to address a table is more efficient than using subscripts since the index already contains the displacement from the start of the table and does not have to be calculated at run time. Subscripts, on the other hand, contain an occurrence number that must be converted to a displacement value at run time before it can be used. When using subscripts to address a table, use a binary (COMP) signed data item with eight or fewer digits (for example, using PICTURE S9(8) COMP for the data item). This will allow full word arithmetic to be used during the calculations. Additionally, in some cases, using four or fewer digits for the data item may also offer some added reduction in CPU time since half word arithmetic can be used.

    To create efficient index:
    Create indexes based on use.
    Keep clustered index keys as small as possible.
    Consider range data for clustered indexes.
    Create an index on all foreign keys.
    Create highly selective indexes.
    Consider a covering index for often-used, high-impact queries.
    Use multiple narrow indexes rather than a few wide indexes.
    Create composite indexes with the most restrictive column first.
    Consider indexes on columns used in WHERE, ORDER BY, GROUP BY, and DISTINCT clauses.
    Remove unused indexes.
    Use the Index Tuning Wizard.
    posted by satya @ 10:33 PM   0 comments
    Mainframe Funda - 22
    Performance Improvement:
    Usage Display

    If you will use Usage Display data items for computation then additional overhead is required to convert the data item to the proper type both before and after the computation.

    PACKED-DECIMAL (COMP-3)

    While using COMP-3 for computation then use 15 or fewer digits in PIC clause to avoid the use of library routines for multiplication and division. Using a signed data item with an odd number of digits produces more efficient code since this uses an integral multiple of bytes in storage for the data item.


    Fixed-Point vs Floating-Point

    When conversions are necessary, binary (COMP) and packed decimal (COMP-3) data with nine or fewer digits require the least amount of overhead when being converted to or from floating-point (COMP-1 or COMP-2) data.
    posted by satya @ 10:32 PM   0 comments
    Mainframe Funda - 21
    Performance Improvement:
    21) REGION PARAMETER

    The key to reducing the number of I/O operations is to keep more data in virtual storage. The recommendations given here go in that direction.
    This is done in the EXEC card as

    //STEP1 EXEC PGM=XYZ,REGION=17M

    REGION=17M, will give you all the available 'below' the line storage, and 32M 'above' the line (can be accessed by COBOL II etc.). If this is not enough, you can use REGION=0M which gets you all the available spaces 'above' and 'below' the line. This is not advised as it can corrupt initiators, cause strange abends, and no program should require that much memory.
    posted by satya @ 10:30 PM   0 comments
    Mainframe Funda - 20
    Monday, May 5, 2008
    Performance Improvement:
    20) Data Files handling

    If you are using QSAM file then use large block size whenever possible. If you will specify BLOCK CONTAINS 0 clause for any new files that you are creating and omitting the BLKSIZE parameter in your JCL for these files then system will determine optimal block size. This will improve both CPU time and ELAPSE time significantly.

    If you are writing into a variable length file then AWO (Apply Write Only) option will reduce the number of calls to the Data Management facility for I/O operation. Hence performance will improve.

    If you are writing into VSAM files, increase the number of data buffers (BUFND) for sequential access or index buffers (BUFNI) for random access. From the performance point of view Sequential access is preferable then dynamic access and then random access.

    BUFND=number

    Specifies the number of I/O buffers that VSAM is to use for data records. The minimum is 1 plus the STRNO sub parameter number. This value overrides the BUFND value specified in the ACB or GENCB macro, or provides a value if one is not specified. If you omit STRNO, BUFND must be at least 2. If you omit BUFND from AMP and from the ACB macro instruction, the system uses the STRNO number plus 1.

    BUFNI=number

    Specifies the number of I/O buffers that VSAM is to use for index records. This value overrides the BUFNI value specified in the ACB or GENCB macro, or provides a value if one is not specified. If you omit BUFNI from AMP and from the ACB macro instruction, VSAM uses as many index buffers as the STRNO sub parameter number; if you omit both BUFNI and STRNO, VSAM uses 1 index buffer. If data access is through the ISAM interface program, specify for the BUFNI number 1 more than the STRNO number, or specify 2 if you omit STRNO, to simulate having the highest level of an ISAM index resident. Specify a BUFNI number 2 or greater than the STRNO number to simulate having intermediate levels of the index resident.


    E.g.

    //PARMFOUT DD SUBSYS= (BLSR,'DDNAME=BLSR04, RMODE31=ALL, MSG=I',
    // 'BUFND=8000, BUFNI=10000, SHRPOOL=04, DEFERW=YES')
    //BLSR04 DD DSN=V1VEPB.PLAN.OUT, DISP=SHR



    OPTION SPECIFIED
    CPU TIME

    ELAPSED TIME
    REGION=8M & AMP=('BUFND=50,BUFNI=20')
    4.62
    360.6
    REGION=8M & DCB=BUFNO=20
    1.78
    92.2
    REGION=4096K & AMP=('BUFNI=30')
    1.34
    49.2
    REGION=8M & AMP=('BUFNI=20')
    0.97
    47.2
    REGION=5M & AMP=('BUFNI=30')
    1.08
    47
    REGION=8M & AMP=('BUFNI=30')
    1
    46.3
    posted by satya @ 10:06 PM   0 comments
    Mainframe Funda - 19
    Performance Improvement:
    19) Using CALL
    The performance of a CALL to a nested program is faster than an external static CALL; external dynamic calls are the slowest. In case of static call programs are link edited together and are in storage but in case of DYNAMIC call each subprograms are link edited separately and only brought together to storage when needed.
    posted by satya @ 10:05 PM   0 comments
    Mainframe Funda - 18
    Performance Improvement:
    18) RENT or NORENT

    If we use RENT option the compiler to generate some additional code to ensure that the program is reentrant. But on an average RENT option is equal efficient as NORENT option.
    E.g.
    This is a API which will fetch data from DB2. So it is a Re-entrant program. To declare RENT the syntax is given below.



    PROCESS OPTIMIZE, RENT
    ******************************************************************
    IDENTIFICATION DIVISION.
    ******************************************************************

    PROGRAM-ID. M1VEH07P.
    AUTHOR. INFOSYS.
    DATE-WRITTEN. 09/20/2004.
    posted by satya @ 10:04 PM   0 comments
    Mainframe Funda - 17
    Performance Improvement:
    17) OPTIMIZE (STD), OPTIMIZE (FULL), or NOOPTIMIZE

    With optimize compiler option we can eliminate duplicate computation, constant computation, unnecessary codes. But while using OPTIMIZE (FULL) we have to initialize unreferenced 01 or 77 level items in procedure division as optimize (full) option deletes all unreferenced items.
    posted by satya @ 10:02 PM   0 comments
    Mainframe Funda - 16
    Performance Improvement
    16) DYNAM or NODYNAM

    A static call occurs when we use the CALL literal statement (where literal is the name of a subprogram) in calling program that is compiled with the NODYNAM option. With NODYNAM, all calls of the CALL literal format in the program are treated as static calls.
    A dynamic call occurs when we use the CALL literal statement in calling program compiled with the DYNAM option, or if you use the CALL identifier statement.
    Hence as a rule we can say - Static or Dynamic CALL is specified through the compiler option NODYNAM or DYNAM.
    Dynamic call
    CALL literal with DYNAM
    CALL identifier (always dynamic) --- Generally we use this method for Dynamic Calls
    Static call
    CALL literal with NODYNAM
    The most important thing to note is “The compiler directive DYNAM or NODYNAM has to be specified in calling module”.

    When a subprogram is called, it may already be in main storage having been link-edited in the same load module with the calling program (static call). Or it may be loaded only at the time it is called (dynamic call).With dynamic loading, the called program is loaded only when it is needed.

    Because a statically called program is link-edited into the same load module as the calling program, a static call is executed more quickly than a dynamic call. A static call is the preferred method if your application does not require the services of the dynamic call (which are discussed below). For storage considerations of using static calls versus dynamic calls.

    E.g.
    To declare a program DYNAM or NODYNAM the syntax is
    PROCESS OPTIMIZE,NODYNAM
    ID DIVISION.
    PROGRAM-ID. M1VEH410.
    AUTHOR. N. SALINAS.
    DATE-WRITTEN. 2/17/97.
    DATE-COMPILED.

    For dynamic called module in the working storage section we have to declare variable like

    01 DYNAMIC-CALL-MODULES.
    05 M1VEH51O PIC X(8) VALUE 'M1VEH51O'.
    05 WS-MODULE-NAME PIC X(08) VALUE 'M1VEH410'.
    05 WS-PLSMR-API PIC X(08) VALUE 'M1VEH41A'.
    05 WS-PBNFR-API PIC X(08) VALUE 'M1VEH41B'.
    01 M1VEH51O-PARMS.
    05 H-BIC PIC X(05).
    Then we will have to call these programs dynamically like
    CALL M1VEH51O USING M1VEH51O-PARMS

    For static call we need not have to declare variable in WS-section we can directly call these modules like
    05 WS1-GREG-DATE-PARM.
    10 WS1-GREG-DATE-LENGTH PIC S9(4) COMP
    VALUE +8.
    10 WS1-GREG-DATE.
    15 WS1-GREG-DATE-CC PIC XX.
    15 WS1-GREG-DATE-YY PIC XX.

    CALL 'CEEDAYS' USING WS1-GREG-DATE-PARM
    posted by satya @ 9:58 PM   0 comments
    Mainframe Funda - 15
    Saturday, May 3, 2008
    Performance improvement of a COBOL-DB2 program
    15) AWO or NOAWO
    AWO stands for apply write only. If in a application there is a large variation in the size of the record to be written then specifying AWO will improve performance by reducing the calls to the Data Management Service to handle I/Os
    posted by satya @ 11:00 PM   0 comments
    Mainframe Funda - 14
    Performance improvement of a COBOL-DB2 program
    14) ARITH - EXTEND or COMPAT:
    By specifying ARITH complier option we can control the maximum number of digits allowed for decimal numbers (packed decimal, zoned decimal and numeric-edited data items and numeric literals).
    ARITH – EXTEND: - Max. Number of digits 31.
    ARITH – COMPAT: - Max. Number of digits 18.
    Arith-extend is performance hampering because of larger intermediate results.
    posted by satya @ 10:57 PM   0 comments
    Mainframe Funda - 13
    13. Converting a file from VB to FB.

    DFSORT can be used to do VB to FB conversion, when sorting, copying or merging. The VTOF or CONVERT and OUTREC operands of OUTFIL can be used to change variable-length (e.g. VB) input records to fixed-length (e.g. FB) output records. VTOF or CONVERT indicates that conversion is to be performed and OUTREC defines the reformatted records. All output data sets for which VTOF or CONVERT is used must have or will be given fixed-length record formats.
    An example of OUTFIL conversion:

    //VTOF EXEC PGM=SORT
    //*
    //SYSPRINT DD SYSOUT=*
    //SYSOUT DD SYSOUT=*
    //SYSDUMP DD SYSOUT=*
    //SORTIN DD DSN=M145.TEMP.SORT.IN,
    // DISP=SHR
    //SORTOUT DD DSN=M145.TEMP.SORT.OUT,
    // DISP=(NEW,CATLG,DELETE),UNIT=DASD,
    // SPACE=(TRK,(500,500),RLSE),
    // DCB=(RECFM=FB,LRECL=80)
    //SYSIN DD *
    SORT FIELDS=COPY
    OUTFIL FNAMES=SORTOUT,VTOF,OUTREC=(5,80),VLFILL=C'*'
    //*

    The above step will copy the records from SORTIN to SORTOUT. If the input records are shorter than 80 bytes, the output is padded with ‘*’ (Specified by VLFILL). If VLFILL option is not specified, by default the records are padded with spaces.
    VLFILL=C’x’ => pad with the character x.
    VLFILL=X’yy’ => pad with hexadecimal character X’yy’.
    posted by satya @ 3:33 AM   0 comments
    Mainframe Funda - 12
    12. Sending the message within the mainframe terminals.
    Do you know how to send text messages from one mainframe terminal (say from SAH0963) to another (say to BIS1982)?
    If not, then the command is:
    TSO SE ‘’ U ()
    Example: TSO SE ‘HI !!!’ U(BIS1982)
    Note> please type the command on ISPF Command Shell i.e. option 6 for FTP
    posted by satya @ 3:28 AM   0 comments
    Mainframe Funda - 11
    Friday, May 2, 2008
    11. Copying large number of members from one PDS to another.
    Many times we need to copy huge number of members from one PDS to another. But if we will copy this in 3.3 then we will face time abend. So we can submit a simple JCL to copy all or selected members of a PDS to another. Below is the JCL.
    //PDSCOPY EXEC PGM=IEBCOPY,REGION=1024K,TIME=NOLIMIT
    //SYSPRINT DD SYSOUT=*,OUTLIM=99999
    //I1 DD DSN=INTP.BASE.ABCD.SRC,
    // DISP=SHR
    //*
    //O1 DD DSN=YYY.D1234.CMSRC.PLI,
    // DISP=SHR
    //SYSIN DD *
    COPY1 C O=O1,I=((I1,R))
    /*
    Here I1 is the input PDS, O1 is the output PDS. In the above example I am trying to copy all the members of input PDS to output PDS with replacement on.COPY1 C O=O1, I= ((I1, R)) this like says Copy members to output Pds given in O1 from input PDS I1 with replace i.e if earlier a version of a member is existing then it will replace that with what ever version present in input PDS.
    If you want to copy selected members then your SYSIN card should be like below:
    //SYSIN DD *
    COPY1 C O=O1,I=((I1,R))
    SELC1 S M=BTCYCST
    SELC2 S M=BTOLCTL
    /*
    posted by satya @ 10:32 PM   0 comments
    Mainframe Funda - 10
    10. Searching particular word from number of modules.
    Many times we need to search particular word from a number of modules in a PDS.You can do this with the help of some useful Mainframe commands or by Jcl or writing some programs in SAS/REXX/PLI or by P.7/3.14.But P.7 / 3.14 will take lot of time if the number of members present in the PDS is large. So Today I am giving how you can copy particular records from a file with the help of JCL.
    //SGNLP14 EXEC PGM=PDSM18,REGION=0M,TIME=NOLIMIT
    //PDSMPDS DD DSN=YYY.STRC.PLI,DISP=SHR
    //PDSMRPT DD DSN=YYY.D1234.SRCH.OUTPUT,
    // DISP=(NEW,CATLG,DELETE),UNIT=TST1,
    // DCB=(LRECL=133,RECFM=FBA,BLKSIZE=7448),
    // SPACE=(7448,(2000,2000),RLSE)
    //PDSMSEL DD *
    /*
    //SYSIN DD *
    OPTION MISSMSG=N,
    LISTMEM=N,
    TRANSLATE=Y,
    SCAN TARGET=' FILE'
    /*
    In the above example I want to search all the modules having keyword FILE.
    This statement SCAN TARGET=' FILE' signifies ' FILE' is the targeted keyword to be searched.
    posted by satya @ 10:31 PM   0 comments
    Mainframe Funda - 9
    9. Selecting particular fields from records of a large file.
    Many times we need to select particular Fields from records of a large file. You can do this with the help of some useful Mainframe commands or by JCL or writing some programs in SAS/REXX/PLI. Today I am giving how you can copy particular records from a file with the help of JCL.
    //SGNLP03 EXEC PGM=SORT
    //$ORTPARM DD DSN=XXX.EDPNTR.DATA.UTLCNTL(DTSTAP),DISP=SHR
    //SYSIN DD *
    OUTREC FIELDS=(1,8,11C' ',C'A',60C' ')
    SORT FIELDS=COPY
    /*
    //SORTIN DD DSN=YYY.D1234.CANSRCB,DISP=SHR
    //SORTOUT DD DSN=YYY.D1234.CANSRCB.OUTPUT,
    // DISP=(NEW,CATLG,DELETE),UNIT=TST1,
    // DCB=(XXX.DATAPRC.DATA.PNHDCB,
    // LRECL=80,BLKSIZE=6400),
    // SPACE=(6400,(1900,950),RLSE)
    //SYSOUT DD SYSOUT=*
    //*
    In the above example I want to select the filed starting from column 1 of length 8 bytes from the input file then I want to add 11 spaces and then a character A and then 60 spaces. Lets take from 1-8 there is policy number.
    This statement (1,8,11C' ',C'A',60C' ')signifies 1 -- starting column of the policy number in the input file.
    8 -- length of the policy number field.
    11C' ' -- for Adding 11 spaces after the policy number
    C'A' -- character A added after 11 spaces
    60C' ' -- 60 Spaces added after the character A
    posted by satya @ 10:29 PM   0 comments
    Mainframe Funda - 8
    8. Selecting particular record from a large file:
    Many times we need to select particular records from a large file. You can do this with the help of some useful Mainframe commands or by Jcl or writing some programs in SAS/REXX/PLI. Today I am giving how you can copy particular records from a file with the help of JCL.
    //JUN3P05 EXEC PGM=SORT
    //$ORTPARM DD DSN=XXX.EDPCNTR.DATA.UTLCTL
    //SYSIN DD *
    SORT FIELDS=COPY >> Sort Card
    INCLUDE COND=((19,8,CH,EQ,C'17519325',AND, >> Policy Number
    13,5,CH,EQ,C'68469',AND, >> Agent Number
    10,3,CH,EQ,C'004'),OR, >> GA Number
    (19,8,CH,EQ,C'17537547',AND, >> 2nd set
    13,5,CH,EQ,C'68469',AND,
    10,3,CH,EQ,C'004'))
    /*
    //SORTIN DD DSN=YYY.D3456.LINSCME.TEST,DISP=SHR >> Input file
    //SORTOUT DD DSN=YYY.D1234.LINSCME.TEST.INPUT, >> Output file
    // DISP=(NEW,CATLG,DELETE),UNIT=TST1,
    // DCB=(YYY.D3456.LINSCME.TEST),
    // SPACE=(CYL,(10,5),RLSE)
    //SYSOUT DD SYSOUT=*
    In the above example I want to select all the records having (policy number 17519325 and Agent Number 68469 and GA code 004) or (policy number 17537547 and Agent Number 68469 and GA code 004) like this you can add multiple lines.
    This statement (19,8,CH,EQ,C'17519325') signifies 19 -- starting column of the policy number in the input file.
    8 -- length of the policy number field.
    EQ -- for Equal
    C'17519325'-- character 17519325
    posted by satya @ 10:27 PM   0 comments
    Mainframe Funda - 7
    7. AUTOTYPE
    How wonderful it feels when Internet explorer suggests names for URLs when we start typing the first few letters! Our mainframe also has the ability to do pretty much the same. Using ‘KEYS’ command on the command line, assign a free PF key with the value ‘AUTOTYPE’. We are all set.
    Now use 3.4 to go to the Data Set list utility and then type the first few qualifier of the required data set. Press the desired PF key. It will show you the dataset name
    which is nearest match.
    posted by satya @ 10:25 PM   0 comments
    Mainframe Funda - 6
    6. Know the person who opened particular member in the Dataset.
    Try this one
    1. When you try to open a member which was previously opened in edit mode by Some other person a message YYYears “Member in use”.
    2. Now Press F1 twice to get the TSO ID of the person who has taken exclusive lock Over the member.
    3. Then in the command prompt, type TSOID <>”.Hit enter.
    4. You will get the person’s name.
    posted by satya @ 10:21 PM   0 comments
    Mainframe Funda - 5
    5. See the list of the Last 25 commands you have typed.

    You can see the list of the last 25 commands you have typed by using the command RETP.
    Then give the number of the command you want to use and press enter – you will see it on the command line ready for execution.
    posted by satya @ 9:11 PM   0 comments
    Mainframe Funda - 4
    4. Shorter method to open the dataset/dataset member in Edit Mode.

    Many a times we feel we have to type too many things while using Mainframes. Here is one useful tip to reduce the amount of typing, and time taken therefore:

    Editing a Dataset member directly from the command line:

    Normally to edit/browse a PDS member we have to –
    I. Type 3.4
    II. Press enter
    III. Give the dataset name / higher level qualifiers
    IV. Press enter
    V. Select the relevant PDS to display the member list by writing ‘M’ by the name
    VI. press enter
    VII. Select the member to view / edit
    VIII.Press enter
    Finally we are there to edit the member.

    Well, there is a shorter way to do this –
    I. Write EPDF ‘entire path name of the dataset (member)’ at the command line in ISPF panel
    II. Press enter
    The dataset / dataset member opens in Edit mode!!

    Some points specific to NM environment / our project –
    Since due to our naming conventions, the data set names are too long to fit on the command line in the ISPF Primary Option panel. We can use the longer command line with option 6.
    posted by satya @ 8:56 PM   0 comments
    Mainframe Funda - 3
    3. Saving the changes to a member which is opened in view mode.

    Want to save changes made to a flat file/ member of a dataset opened in view mode?

    Try this one...

    REPLACE .ZF .ZL
    posted by satya @ 8:31 PM   0 comments
    Mainframe Funda - 2
    2. Recovering Deleted Flat files

    Flat files can be recovered by following the below mentioned steps.

    Recovering Deleted Flat Files
    --------------------------------------------
    1: Start 6
    2: HLIST BCDS DSN('filename')
    3: Wait for the system notification
    4: Type the command HRECOVER 'filename' and wait for system notification
    Different variations of HRECOVER are given below.
    HRECOVER 'filename' recovers with same name
    HRECOVER ‘old filename’ NEW ('new filename') recovers and assigns new name
    HRECOVER 'file name' REPLACE recovers replacing a file with same name
    The recovery might take some time.
    posted by satya @ 8:26 PM   0 comments
    Mainframe Funda - 1
    1. TSO DELETE Command

    You can delete any dataset by entering the command TSO DELETE ‘’ in any mainframe panel (be it ISPF, TSO or command line).

    E.g. type TSO DELETE ‘YYY.D0963.PLI’ and press enter. The dataset YYY.D0963.PLI will get deleted. This command is commonly used before submitting test JCLs which do not contain a delete step as the first step of the job. The unwanted datasets are deleted by using this command.
    posted by satya @ 8:17 PM   0 comments
    About Me

    Name: satya
    Home: Bhubaneswar/Rocky hill, Orissa/CT, India
    About Me: Hi I am working in Mainframe Technology. Created this blog to share Mainframe smart tricks which will make work easier.
    See my complete profile
    .::Recent Posts::.
    .::Archives::.
    .::My other Blogs::.