Friday, February 17, 2012

Bypassing Label processing for tape datasets


Bypass Label Processing (BLP) is a method of accessing tapes or cartridges. Use of BLP is usually restricted, requiring RACF authority, because great care is required. 
BLP is often used if the dataset name or volume serial is not known, such as when recieving a tape from an external organization.
To specify that you want to read a tape or cartridge using BLP, you should specify BLP in the LABEL parameter of the DD statement. 
LABEL=(2,BLP) specifies you want to read the second file on the tape/cartridge. Note that any Headers and Trailers on the tape/cartridge are treated as being files. 
Any tape format can be read using BLP, from Standard Label to No Label.
To calculate the file number use the following formula:
x=3y - 1
where x is the number to be used with BLP (ie LABEL=(x,BLP) ), and y is the number of the file (excluding headers, trailers,etc) that you want to access (ie the file number you would use for standard labels (SL) ), so if you want to access the first file on a tape (with headers & trailers) x would be (3*1) - 1 , So you would code LABEL=(2,BLP). The second file would be accessed using LABEL=(5,BLP). (Remember there will be headers and trailers for each file). 
To access the Header record code LABEL=(,BLP)   
 No dataset name or volume serial number validation is done with BLP so your DSN name and VOL=SER can be set to any value.
When you run your job with BLP a message will appear on the Operator Console requesting the Volume Serial Number. Once the VOLSER is entered at the console the job step will start and the tape is processed.

Avoiding tape mount in IEFBR14 step for tape datasets



Let us assume that MY.TAPE.DSN is in tape. The below IEFBR14 step is trying to delete the file. To delete the file, first it mounts the tape volume which has the dataset and then it deletes the dataset.

//JS0050 EXEC PGM=IEFBR14 
//DEL01  DD   DSN=MY.TAPE.DSN, 
//            DISP=(MOD,DELETE,DELETE)


To avoid such unnecessary tape mount, we can use IDCAMS utility to delete the tape datasets as shown below. This also avoids the unnecessary delay in the execution of the job.


//STEP1    EXEC PGM=IDCAMS                      
//SYSPRINT DD  SYSOUT=*                         
//SYSIN    DD  *                                
 DEL MY.TAPE.DSN
/*            

VSAM buffering tips

Tuning Sequential Access


Default data buffers for KSDS is 2
  • one reserved for splits
  • #of I/O equal number of data CI’s that contain data 
Determining Optimal Data Buffers for Input Data Set

Best performance is achieved when data component is read in full tracks

CI/Track=(PHYRECS/TRK) x (PHYREC-SIZE)
                     CISZD

PHYRECS/TRK = physical records per track  - from LISTCAT  
PHYREC-SIZE = physical record size  - from LISTCAT  
CISZD= data control interval size - from LISTCAT  

Optimum value of BUFND is =CIs per track +1

Example:

From IDCAMS LISTCAT..
CISIZE--------------4096
PHYRECS/TRK-----------12
PHYREC-SIZE---------4096

CI/Track=12 x 4096 = 12
              12
BUFND (for input dataset)=CI/TRK+1     = 13
BUFND (for output dataset)=CI/TRK+2    = 14

Random Access - Batch
Default index buffers for KSDS is 1

Best performance is achieved when enough buffers are allocated to keep all index CI’s in memory, plus one for the sequence set reads.

Index Buffers for Input Data Set

BUFNI=HURBAI -      HURBAD      + 1
      CISZI    CISZD X (CI/CA)

HURBAI = High Used RBA of index component   - from LISTCAT 
HURBAD = High Used RBA of data component   - from LISTCAT  
CI/CA = number of data CI in each data CA  - from LISTCAT  
CISZI= index control interval size - from LISTCAT  
CISZD= data control interval size - from LISTCAT  

Example:
From IDCAMS LISTCAT..
HI-U-RBA (index)-----------12288 
CISIZE (data)--------------4096
HI-U-RBA (data)----------540672
CI/CA--------------------12

BUFNI = 12288 - 540672  + 1
        1024   4096 X 12


BUFNI = 12 - 11 + 1 = 2


COBOL: Blocked and unblocked files

If the creating program lacks a file blocking statement the dataset is created with no record blocking (i.e. FIXED)!!


FD  CRBREDL                               
    BLOCK CONTAINS 0 RECORDS  ---> If omitted causes BLKSIZE=F            
    LABEL RECORD IS STANDARD              
    RECORDING MODE IS F.                  
01  CRBREDL-REC                 PIC X(43).


From the IBM manual, "Enterprise COBOL for Z/OS"


"In a COBOL program, you can establish the size of a physical record with the BLOCK CONTAINS clause. If you do not use this clause, the compiler assumes that the records are NOT blocked. Blocking QSAM files on disk can enhance processing speed and minimize storage requirements."  




SPACE (cyls)
EXCPS
(number of I/Os)
# Records
CLOCK TIME (minutes)
Unblocked (LRECL=43)
2588
4142000
1107944
149.2
Blocked at half-track (standard)
183
1061000
1250200
73.3
Savings
93% reduction
74% reduction
13% increase
51% reduction


Huge space and clock savings in spite of 13% increase in volume.

Monday, February 13, 2012

COBOL : Auto key generation


You might have come across situations in batch programs to auto generate keys.

Let us say we want to generate four byte keys in the following order
0001,0002,0003,…..9999,999A,……ZZZZ

The below program reads the last key generated and generates next key


WORKING-STORAGE SECTION.                                        
01 REC1.                                                        
   05 FILLER PIC X(36)                                          
      VALUE '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'.             
01 REC2 REDEFINES REC1.                                         
   05 CHAR   PIC X(01) OCCURS 36 TIMES                          
                       INDEXED BY IX1, IX2, IX3, IX4.           
01 LAST-KEY  PIC X(04).                                         
01 NEXT-KEY  PIC X(04).                                         
PROCEDURE DIVISION.                                             
     MOVE 'YYYY' TO LAST-KEY.                                   
     PERFORM VARYING IX1 FROM 1 BY 1                            
             UNTIL CHAR(IX1) = LAST-KEY(1:1)                    
     END-PERFORM                                                
     PERFORM VARYING IX2 FROM 1 BY 1                            
             UNTIL CHAR(IX2) = LAST-KEY(2:1)                    
     END-PERFORM                                                
     PERFORM VARYING IX3 FROM 1 BY 1                            
             UNTIL CHAR(IX3) = LAST-KEY(3:1)                     
     END-PERFORM                                                
     PERFORM VARYING IX4 FROM 1 BY 1                            
             UNTIL CHAR(IX4) = LAST-KEY(4:1)                    
     END-PERFORM                                           
     IF IX4 = 36                                          
        SET IX4 TO 1                                      
        IF IX3 = 36                                       
           SET IX3 TO 1                                   
           IF IX2 = 36                                    
              SET IX2 TO 1                                
              IF IX1 = 36                                 
                 SET IX1 TO 1                             
              ELSE                                         
                 SET IX1 UP BY 1                          
              END-IF                                      
           ELSE                                           
              SET IX2 UP BY 1                              
           END-IF                                         
        ELSE                                              
           SET IX3 UP BY 1                                
        END-IF                                             
     ELSE                                                 
        SET IX4 UP BY 1                                   
     END-IF                                               
     MOVE CHAR(IX1) TO NEXT-KEY(1:1)                      
     MOVE CHAR(IX2) TO NEXT-KEY(2:1)   
     MOVE CHAR(IX3) TO NEXT-KEY(3:1)   
     MOVE CHAR(IX4) TO NEXT-KEY(4:1)   
     DISPLAY NEXT-KEY                  
     GOBACK.                           

Wednesday, February 8, 2012

What is QA Hiperstation


Compuware Hiperstation is a suite of tools that streamlines the testing process and helps improve the quality of your applications. The Hiperstation tool suite offers these products:
Hiperstation for VTAM provides the means for testing applications that use a 3270 user interface, or SNA LU0/LU2 communication protocols via unattended and interactive tools. It also provides an Automated Testing Vehicle (ATV) Manager and an auditing function for security monitoring.  
Hiperstation for Mainframe Servers includes support for testing applications using HTTP and HTTPS protocols. It includes SNA testing support and expands this support to test APPC/LU6.2 applications.  
Hiperstation for WebSphere MQ enables the testing of applications that use WebSphere MQ.  
All of the Hiperstation products include the following functions:
Record: Captures user sessions on a keystroke-by-keystroke or message-by-message basis. This is accomplished through a global record function for ALL components and interactively in the case of 3270 applications.
Playback: Re-executes previously recorded sessions either online in interactive or non-stop mode, or in a batch job.
Comparison: Compares the output of the current playback session with the recorded session.
Each of the components also has specific capabilities to aid testing in their respective environments. For advanced testing, Hiperstation incorporates IBM's REXX script language, allowing you to customize and enhance script creation, playback, and reporting.

Using QA Hiperstation to record a CICS session


This article explains how to record the CICS transactions that you execute in a CICS region in a dataset using QA Hiperstation.


Select option “1” for “Hiperstation for VTAM”


------------------------ Hiperstation - Product Menu --------------------------
 Option  ===> 1                                                                
                                                                               
                                                                               
   0  Hiperstation Profiles              Set user profiles                     
   1  Hiperstation for VTAM              VTAM Application Testing              
   2  Hiperstation for Mainframe Server  SNA/APPC & HTTP Testing (Not licensed)
   3  Hiperstation for WebSphere MQ      WebSphere MQ Message Tes (Not licensed)
                                                                               
      Profile         ===>                                                     
      Profile dataset ===>                                                      
                                                                               
      Leave Profile blank for selection list                                   
      Leave Profile dataset blank to create new dataset                        
      Leave both blank to run with no Profile                                  
                                                                               
                                                                                
               See Hiperstation frequently asked questions at:                 
                        http://frontline.compuware.com                         
                                                                                
     Copyright (C) 1994, 2009 Compuware Corporation.  All Rights Reserved.     
  Unpublished-rights Reserved Under the Copyright Laws of the United States .   
                                                                               
 Type LEGAL on the command line for Copyright/Trade Secret Notice information  


Select option “1”

-------------------------  Hiperstation - Main Menu  --------------------------
 Option  ===> 1                                                                
                                                                               
                                                      Product Release: 07.08.00
   1  Domain Traveler              Record and Playback                         
   2  Quick Play                   Select a Script and Go                      
   3  Session Demo                 Demonstrate Online Applications             
   4  Global Recording             System and Application Test Creation        
   5  Archive/Search               Audit and Help Desk Functions               
   6  Script Processors            Automatic Script Editing                    
   7  Unattended Processing        Setup Unattended Playback and Compare Jobs  
   8  File Manager                 File Manager                                
   9  ATV Manager                  Automated Testing Vehicle (ATV) Manager     
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               

Type CICS region name as shown below
                                                                                

------------------------ Hiperstation * Domain Traveler -----------------------
 Command ===>                                                                  
                                                                                
   Use this panel to connect to one of your site's domains.  When              
   connected you can record your session or play back previous sessions.       
                                                                                
    Domain Destination . CICSTEST                                              
                                                                               
      Change session options (Enter "/")                                       
                                                                                
                                                                               
     Start = ISPF , Zoom = F23  , LUName = Default  , Restore Keyboard         
     Logmode = D4A32782 , Model = 3-(32X80) , SNA = Yes , Queriable = Yes      
     Application Profiling(Off) , IMS = Y                                      
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
Type command “ RECORD ON ” to record the transactions
                                                                               


ZOOM:F23 ------------------ HIPERSTATION ------------------------ LINE 1 OF 24
 Command ===> record on                                        Scroll ===> PAGE
 Record OFF  Play OFF  Journal OFF  Compare Log OFF  autoDoc OFF               
                            Signon to CICS                       APPLID CICSTEST
                                                                               
 WELCOME TO CICS/TS 4.1.0 REGION CICSTEST                                      
                                                                                
                                                                               
                                                                               
                                                                                
 Type your userid and password, then press ENTER:                              
                                                                               
          Userid . . . .             Groupid . . .                              
          Password . . .                                                       
          Language . . .                                                       
                                                                               
      New Password . . .                                                       
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               

In the ISPF 3.2 screen allocate a PDS as shown below.
                                                                               
                                                                               
   Menu  RefList  Utilities  Help                                               
 ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
                             Allocate New Data Set                             
 Command ===>                                                                  
                                                                    More:     +
 Data Set Name  . . . : TSUXXXX.QAH                                            
                                                                               
 Management class . . .                (Blank for default management class)    
 Storage class  . . . .                (Blank for default storage class)       
  Volume serial . . . .                (Blank for system default volume) **    
  Device type . . . . .                (Generic unit or device address) **     
 Data class . . . . . .                (Blank for default data class)          
  Space units . . . . . CYLINDER       (BLKS, TRKS, CYLS, KB, MB, BYTES        
                                        or RECORDS)                            
  Average record unit                  (M, K, or U)                            
  Primary quantity  . . 2              (In above units)                        
  Secondary quantity    2              (In above units)                         
  Directory blocks  . . 0              (Zero for sequential data set) *        
  Record format . . . . VB                                                     
  Record length . . . . 256                                                     
  Block size  . . . . .                                                        
  Data set name type    LIBRARY        (LIBRARY, HFS, PDS, LARGE, BASIC, *     
                                        EXTREQ, EXTPREF or blank)              
  Extended Attributes                  (NO, OPT or blank)                      


Type the PDS allocated above with a member as shown below


------------------------ Hiperstation * Recording Setup -----------------------
 Command ===>                                                                   
                                                                               
 Recording File Name:                                                          
  Project . . . .                                                               
  Group . . . . .                                                              
  Type  . . . . .                                                              
  Member  . . . .                 (Blank or pattern for member selection list) 
  Other Dsn . . . 'TSUXXXX.QAH(TEST)'                                          
                                                                               
 Description  . .                                                               
                                                                               
 Recording Options:                                                            
   Enter "/" to select option                                                  
     Replace Like Member(s)                                                    
   / Format Recording                                                          
     Record Inputs Only                                                        
     Stop Recording                                                             
   / Script Recovery                                                           
     Input fields in (row,column) format                                       
     File Manager                                                               
                                                                               
              Press ENTER to begin recording,  END to cancel setup.            
                                                                                

Below screen shows that Hiperstation is ready to record your transaction


ZOOM:F23 ------------------ HIPERSTATION --------------- RECORDING IN PROGRESS
 Command ===>                                                  Scroll ===> PAGE
 Recording TEST      Play OFF  Journal OFF  Compare Log OFF  autoDoc OFF       
                            Signon to CICS                       APPLID CICSTEST
                                                                                
 WELCOME TO CICS/TS 4.1.0 REGION CICSTEST                                      
                                                                               
                                                                               
                                                                                
                                                                               
 Type your userid and password, then press ENTER:                              
                                                                                
          Userid . . . .             Groupid . . .                             
          Password . . .                                                       
          Language . . .                                                        
                                                                               
      New Password . . .                                                       
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               


Use Shift+PF11 to toggle between the Hiperstation menu and the region.  Pressing Shift+PF11 key in the above screen, shows the below CICS screen in full screen mode.

                            Signon to CICS                       APPLID CICSTEST
                                                                               
 WELCOME TO CICS/TS 4.1.0 REGION CICSTEST                                      
                                                                               
                                                                                
                                                                               
                                                                               
 Type your userid and password, then press ENTER:                              
                                                                               
          Userid . . . . TSUXXXX     Groupid . . .                             
          Password . . .                                                        
          Language . . .                                                       
                                                                               
      New Password . . .                                                        
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
 DFHCE3520 Please type your userid.                                            
 F3=Exit                                                                        


Completed the above sign on screen and entered “CMAC” transaction.


CMAC                                                                           
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
 DFHCE3549 Sign-on is complete (Language ENU).                                 


Type “ASRA” to see the explanation


DFHCMC01              Display On-line Messages and Codes                      
                                                                               
                                                                                
 Type the required message identifier, then press Enter.                       
                                                                               
                                                                                
                                                                               
      Component ID. . . .      (for example, TC for Terminal Control           
                                             FC for File Control, etc.)        
                               This field is required for messages in the      
                               form DFHxxyyyy, where xx is the Component ID.   
                                                                                
      Message Number. . . ASRA (for example, 1060, 5718, or Abend Code         
                               such as ASRA, etc.)                             
                                                                                
                                                                               
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
 F3=Exit to CICS                                                               






           ASRA                                                                 
                                                                               
                                                                               
           EXPLANATION:  The task has terminated abnormally because            
           of a program check.                                                 
                                                                               
           SYSTEM ACTION:  The task is abnormally terminated and CICS          
           issues either message DFHAP0001 or DFHSR0001.  Message              
           DFHSR0622 may also be issued.                                       
                                                                                
           USER RESPONSE:  Refer to the description of the associated          
           message or messages to determine and correct the cause of           
           the program check.                                                   
                                                                               
           MODULE:  DFHSRP                                                     
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
 F3=Cancel                                                                     


Press clear key and then Shift+PF11 key to go back to Hiperstation and type “RECORD OFF” to stop the recording.

ZOOM:F23 ------------------ HIPERSTATION ------------------------ LINE 1 OF 24
 Command ===> RECORD OFF                                       Scroll ===> PAGE
 Recording TEST      Play OFF  Journal OFF  Compare Log OFF  autoDoc OFF       
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               




The blow screen shows that recording has stopped


ZOOM:F23 ------------------ HIPERSTATION ------------------- RECORDING STOPPED
 Command ===>                                                  Scroll ===> PAGE
 Record OFF  Play OFF  Journal OFF  Compare Log OFF  autoDoc OFF               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                



Type “CANCEL” to disconnect the CICS session


ZOOM:F23 ------------------ HIPERSTATION ------------------- RECORDING STOPPED
 Command ===> CANCEL                                           Scroll ===> PAGE
 Record OFF  Play OFF  Journal OFF  Compare Log OFF  autoDoc OFF               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                
                                                                               
                                                                               
                                                                                



Browsing the dataset shows that CICS transaction has been recorded in the dataset.


   Menu  Utilities  Compilers  Help                                            
 sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
 BROWSE    TSUXXXX.QAH(TEST) - 00.00                  Line 00000000 Col 001 080
 Command ===>                                                  Scroll ===> CSR 
********************************* Top of Data **********************************
************************************************************************       
* CREATED BY USER:  TSUXXXX TPF: CICSTEST TIME: 20:39 DATE: 02/08/12   *       
* DESC:                                                                *       
************************************************************************       
* LU: UHG02Q01   TPF: CICSTEST   LOGMODE: D4A32782                     *       
************************************************************************       
<VERSION>7                                                                      
<IMSUNLOK>Y                                                                    
<OUTPUT>0000001 (24,080)                                                       
<RESPONSE>00.00.000                                                             
<S01>............................Signon to CICS ......................APPLID.CIC
<S02>                                                                          
<S03>.WELCOME TO CICS/TS 4.1.0 REGION CICSTEST                                  
<S04>.                                                                         
<S05>.                                                                         
<S06>.                                                                          
<S07>                                                                          
<S08>.Type your userid and password, then press ENTER:                         
<S09>