Tuesday, October 26, 2021

Validate a date whether it is a valid Gregorian date using COBOL function

TEST-DATE-YYYYMMDD function tests whether a date in form (YYYYMMDD) is a valid date in the Gregorian calendar. 

Argument to this function must be an integer and it should be of the form YYYYMMDD.

Function returns following values
  • If the value of argument is less than 16010000 or greater than 99999999, the returned value is 1,which means the year is not within the range of 1601 to 9999.
  • Returned value is 2, when the month is not within the range of 1 to 12.
  • Returned value is 3, when the day is not valid for the given year and month.
  • Otherwise, the returned value is 0 (zero) , which means the date is valid.
Sample COBOL code is below

        IDENTIFICATION DIVISION.                                   
        PROGRAM-ID. DTCONV.                                        
        ENVIRONMENT DIVISION.                                      
        CONFIGURATION SECTION.                                     
        SPECIAL-NAMES.                                             
        INPUT-OUTPUT SECTION.                                      
        FILE-CONTROL.                                              
        DATA DIVISION.                                             
        FILE SECTION.                                              
        WORKING-STORAGE SECTION.                                   
        01 WS-WORK-AREA.                                           
           05 WS-GREG-DATE                  PIC  9(10).            
        01 RC PIC 9(5).                                            
        PROCEDURE DIVISION.                                        
******** Example 1                                                 
******** returns 0 because the date is valid                       
            MOVE 19950215 TO WS-GREG-DATE                          
            COMPUTE RC = FUNCTION TEST-DATE-YYYYMMDD(WS-GREG-DATE) 
            DISPLAY RC                                                  
******** Example 2                                                      
******** returns 1 because the year is invalid and the value of argument
******** is less than 16010000.                                         
            MOVE 12950215 TO WS-GREG-DATE                               
            COMPUTE RC = FUNCTION TEST-DATE-YYYYMMDD(WS-GREG-DATE)      
            DISPLAY RC                                                  
******** Example 3                                                      
******** returns 1 because the year is invalid and the value of argument
******** is greater than 99999999.                                      
            MOVE 912950215 TO WS-GREG-DATE                              
            COMPUTE RC = FUNCTION TEST-DATE-YYYYMMDD(WS-GREG-DATE)      
            DISPLAY RC                                                  
******** Example 4                                                      
******** returns 2 because the month is not within the range            
******** of 1 to 12                                                     
            MOVE 19921415  TO WS-GREG-DATE                              
            COMPUTE RC = FUNCTION TEST-DATE-YYYYMMDD(WS-GREG-DATE)      
            DISPLAY RC                                                  
******** Example 5                                                      
******** returns 3 because the day is invalid                         
            MOVE 19950240  TO WS-GREG-DATE                              
            COMPUTE RC = FUNCTION TEST-DATE-YYYYMMDD(WS-GREG-DATE)      
            DISPLAY RC                                                  

How to pass data to a program present many levels down the calling chain


Let us say we have below calling chain

Program A --> Program B ---> Program C ---> Program D --> Program E

And we want to pass data from "Program B" to "Program E"

We can pass data between programs using Files, DB2 tables, Linkage section, TSQs(in case of CICs) etc.

There is another way. We can create a simple program to act as a cache. This technique works well in both online and batch environments.

Here I am using a sub program called "CACHEPGM" as a cache. 

       IDENTIFICATION DIVISION.  
       PROGRAM-ID.    CACHEPGM.
       ENVIRONMENT DIVISION. 
       DATA DIVISION.       
       WORKING-STORAGE SECTION.  
       01 WS-SAVE-DATA PIC X(80) VALUE SPACES. 
       LINKAGE SECTION.                        
       01 LS-PARAMETERS.  
          05 LS-FUNC          PIC X(4) VALUE SPACES. 
               88 LS-SET-DATA           VALUE 'SET'.  
               88 LS-GET-DATA           VALUE 'GET'.      
           05 LS-DATA         PIC X(80). 
       PROCEDURE DIVISION USING LS-PARAMETERS. 
           EVALUATE TRUE  
             WHEN LS-SET-DATA  
               MOVE LS-DATA      TO WS-SAVE-DATA   
             WHEN LS-GET-DATA 
               MOVE WS-SAVE-DATA TO LS-DATA  
           END-EVALUATE   
           GOBACK.    

From "Program B" invoke CACHEPGM with SET parameter and data to be stored in the cache.

From "Program E" invoke CACHEPGM with GET parameter and to retrieve the data stored in the working storage section of CACHEPGM.

Wednesday, October 20, 2021

Useful ESP commands

Below are some of the useful CA ESP scheduler commands

AJ ALL APPL(TESTFASD.1155) HOLD                     
- HOLD operand stops submission of jobs in the application and places the application in APPLHOLD status.

AJ ALL APPL(TESTFASD.1155) RELEASE                  
- Releases an application (removes it from APPLHOLD status)

AJ ALL APPL(TESTFASD.1155) UNWAIT                   
- Removes an application from APPLWAIT status

AJ ALL APPL(TESTFASD.1155) WITHDRAW                 
- WITHDRAW ENTIRE APPL                                     

AJ ALL APPL(TESTFASD.1155) COMPLETE                 
- Completes All the jobs in the application once there are no APPLHOLD and APPLWAIT conditions on it

AJ ALL APPL(TESTFASD.1155) TERMINATE                
- Completes an application immediately. CA WA ESP Edition removes any APPLHOLD and APPLWAIT conditions 

DELETE CYBER.PAYROLL                                
- Delete an Event

AJ TESTCGP HOLD APPL(TESTPCPM.624)                  
- MANHOLD A JOB called TESTCGP                                 

AJ TESTCGP DROPRES APPL(TESTPCPM.624)               
- Removes all resource requirements for TESTCGP  job

AJ TESTCGP READY APPL(TESTPCPM.624)                 
- Removes all job dependencies (except resources) from TESTCGP job (including time, predecessors, manual hold)

AJ TESTBIP  RELEASE APPL(TEST1MCW.534)              
- RELEASE MANFOLD for TESTBIP JOB    

AJ TESTMZ26 COMPLETE APPL(TESTCCBP.007)             
- FORCE COMPLETE TESTMZ26 JOB     

AJ TESTMZ26 WITHDRAW APPL(TESTCCBP.007)             
- WITHDRAW TESTMZ26 JOB     

AJ TESTMZ26 DROPDEP  APPL(TESTCCBP.007)             
- Drops all predecessor relationships for TESTMZ26 job

AJ TESTMZ26 BYPASS APPL(TESTCCBP.007)               
- Indicates that TESTMZ26 job is no longer required. As soon as the dependencies are met, the job is bypassed. Successor jobs are posted as in a normal job completion. If a job is bypassed, it can be unbypassed at any time up to submission.

AJ TESTMZ26 UNBYPASS APPL(TESTCCBP.007)            
 - Indicates that a job must no longer be bypassed.

AJ TESTR71P REQUEST APPL(TESTORG1.028)              
- TO REQUEST A JOB          

AJ TESTR71P UNREQUEST APPL(TESTORG1.028)            
- Specifies that an on-request job is no longer required

AJ TESTAGET RESET DELAYSUB(RESET) APPL(TESTAGET.12) 
- DROP TIME WAIT                                

AJ PAYJOB7 RESET DELAYSUB('9PM') APPL(PAYROLL.0)    
-  resets PAYJOB7's delayed submission time to 9 pm

AJ PAYJOB8 RESET LATEEND(RESET) APPL(PAYROLL.1)       
 -  removes a job's dueout time. CA WA ESP Edition no longer considers the job overdue if the job has not ended by the late end time specified in the job definition

AJ PAYJOB7 RESET EXPECTEDSTART('2PM') APPL(PAYROLL.3)  
-  sets the expected start time to 2PM for job PAYJOB7 in generation 3 of the PAYROLL application:

AJ PAYJOB8 HOLD REASON('WAITING FOR TAPE 09999') APPL(PAYROLL.0)
-     holds a job with a reason

AJ PAYJOB8 RELEASE REASON(.) APPL(PAYROLL.0)       
 -  releases a job and resets the reason field to null

AJ PAYJOBS BYPASS APPL(PAYROLL.0)                  
 - bypasses a subapplication called PAYJOBS. The BYPASS command indicates that all remaining jobs in this subapplication are no longer required.

APPLJOB GLDLYAPPL APPLICATION(GLAPPL.100) WITHDRAW   
- withdraws all incomplete jobs in subapplication GLDLYAPPL of application GLAPPL

AJ PAYJOB4 INSERT APPL(PAYROLL.293) PREDECESSORS(PAYJOB3) SUCCESSORS(PAYJOB5)
 -  inserts PAYJOB4 into generation 293 of the PAYROLL application. PAYJOB4 runs after PAYJOB3 completes successfully, but before PAYJOB5

AJ PAYJOB9 INSERT ATTRIBUTES(HOLD) APPL(PAYROLL.0)  
- inserts PAYJOB9 on hold into the PAYROLL application's current generation

The following AJ commands insert PAYJOB19 on hold into the PAYROLL application's current generation. PAYJOB19 has a time dependency, it's submission time is set to 9 pm and it is then released from hold.
AJ PAYJOB19 INSERT ATTRIBUTE(HOLD) APPL(PAYROLL.0)
AJ PAYJOB19 RESET DELAYSUB('9PM') APPL(PAYROLL.0)
AJ PAYJOB19 RELEASE APPL(PAYROLL.0)

The following AJ command inserts PAYJOB13 into the PAYROLL application's current generation with one predecessor. PAYJOB13 runs after PAYJOB11 completes, whether or not it is successful.
AJ PAYJOB13 INSERT APPL(PAYROLL.0) PREDECESSORS(PAYJOB11(U))

The following AJ command inserts PAYJOB12 with two predecessors into the PAYROLL application's current generation. PAYJOB12 runs after PAYJOB10 and PAYJOB11 complete successfully.
AJ PAYJOB12 INSERT PREDECESSORS(PAYJOB10,PAYJOB11)  APPL(PAYROLL.0)

The following AJ command inserts a task called REPORT.BALANCE into the PAYROLL application's current generation. REPORT.BALANCE runs after PAYJOB6 completes successfully.
AJ REPORT.BALANCE INSERT APPL(PAYROLL) PREDECESSORS(PAYJOB6) ATTRIBUTES(TASK)

The following AJ command resubmits PAYJOB18 using CA WA Restart Option ESP Edition
AJ PAYJOB18 RESUB RESTART APPL(PAYROLL.0)

The following AJ command resubmits PAYJOB2 and selects which steps are rerun.
AJ PAYJOB2 APPL(PAYROLL.0) RESTART RESUB -
FROMSTEP(STEP020) TOSTEP(STEP060) -
EXCLSTEP(STEP0030 STEP0050)

The following AJ command resubmits PAYJOB2 from the CYBER.COPY.JCL library
AJ PAYJOB2 RESUB APPL(PAYROLL.0) -
DATASET('CYBER.COPY.JCL')

SUSPEND ESPM.TESTFMRD - SUSPEND AN EVENT   


The following command TRIGGER AN EVENT STARTING FROM PARTICULAR JOBS   
TR ESPM2D.TEST1DLY ROOT(TEST1DLY,TEST1CDB+)

In the following example, the TRIGGER command suppresses the execution of CYBER.PAYROLL
TRIGGER CYBER.PAYROLL NOXEQ  

Execute CA ESP scheduler commands thru batch jobs


Below job LISTs ESP EVENTS that starts with "PROD"

//STEP01   EXEC PGM=ESP,PARM='SUBSYS(ESP)'                          
//SYSPRINT DD SYSOUT=*                                              
//SYSIN    DD *                                                     
  L LEVEL(PROD) ALL PRINT(OUPUT.LIST.EVENTS)                       
//*                                                                 

Below job PURGE CSF COMPLETED APPLICATIONS AND JOBS 
                        
//STEP01   EXEC PGM=ESP,PARM='SUBSYS(ESP)'     
//SYSPRINT DD SYSOUT=*  
//SYSIN    DD *                                                      
  OPER PURGSCHF NOW                                                
//*   
                                                                  
Below job GENERATES CURRENT LISTING/SETTING OF ESP RESOURCES    
      
//STEP01   EXEC PGM=ESP,PARM='SUBSYS(ESP)'         
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *                                                      
   RESDEF - LIST                                                
//*                                                                  

Below job GENERATES CURRENT LISTING/SETTING OF ESP VARIABLES
                  
//STEP01   EXEC PGM=ESP,PARM='SUBSYS(ESP)'                          
//SYSPRINT DD SYSOUT=*                                              
//SYSIN    DD *                                                     
   VTLIST                                                           
//*                                                                 

Below job SIMULATEs ESP events

//STEP01   EXEC PGM=ESP,PARM='SUBSYS(ESP)'                       
//SYSPRINT DD DSN=output dataset,
//            DISP=(NEW,CATLG,DELETE),  
//            UNIT=SYSDA,                                          
//            DCB=(RECFM=FBA,BLKSIZE=0,LRECL=133),                
//            SPACE=(133,(60,10),RLSE),AVGREC=K                      
//SYSIN    DD *                                                      
   SIMULATE EVENT(PROD.DAILY)                                       
//*                                                                   
//XCFDG1 EXEC PGM=ESP,PARM='SUBSYS(ESP) MASTER'             
//SYSPRINT DD SYSOUT=*                                      
//SYSUDUMP DD SYSOUT=*                                      
//SYSIN DD *                                                
 SIMULATE EVENT(PROD.DAILY) SCHED('10/15/2021 00.01.00')  
/*                                                          

Below job UPDATES VARIABLE called "VK"

//STEP01   EXEC PGM=ESP,PARM='SUBSYS(ESP)'                           
//SYSPRINT DD SYSOUT=*                                               
//SYSIN    DD *                                                      
   VSET WK 2 TABLE(TABLE1)                                           
//*

Below job Trigger an event

//STEP02   EXEC PGM=ESP,PARM='SUBSYS(ESP)'         
//SYSPRINT DD SYSOUT=*                             
//SYSIN    DD *                                    
  TRIGGER PROD.DEMAND
/*                                                 
//                                                 

Below job lists the history run times of D01D001A job

//XCFDG1 EXEC PGM=ESP,PARM='SUBSYS(ESP) MASTER'     
//SYSPRINT DD SYSOUT=*                              
//SYSUDUMP DD SYSOUT=*                              
//SYSIN DD *                                        
 LJS JOB(D01D001A) I                              
/*                                                  

Below two jobs generates reports of job runs

//XCFDG1 EXEC PGM=ESP,PARM='SUBSYS(ESP) MASTER'                    
//SYSPRINT DD SYSOUT=*                                             
//SYSUDUMP DD SYSOUT=*                                             
//SYSIN DD *                                                       
REPORT                                                             
  SETWIDTH 130                                                     
  FROM OCT 15TH 2021 TO OCT 16TH 2021                              
  DISPLAY JOBNAME EXECSDATE EXECST ENDDATE ENDT CPUTIME CMPC     
ENDR                                                               
/*                                                                 

//STEP010 EXEC PGM=ESP,REGION=4M,PARM='SUBSYS(ESP)'  
//SYSPRINT DD  DSN=output dataset
//             DISP=(NEW,CATLG,DELETE),                  
//             UNIT=SYSDA,SPACE=(CYL,(20,20),RLSE),      
//             DCB=(RECFM=FB,LRECL=240,BLKSIZE=13300)    
//SYSIN    DD *
REPORT                 
DATEFORM YMD DAY(NO)    
DISPLAY EXECSDATE 10,EXECST 8,ENDDATE 10,ENDT 8,APPLSYS 8,
SUBAPPL 8,  
JOBNAME 8,JOBNO 6,RC 5,CMPC 8,FORCED 3,STATUS 8,CPUTIME 8, 
TCBTIME 8,SRBTIME 8,EXECQT 5,MINRUNT 5,MAXRUNT 5,AVGRUNT 5,  
ALLOCQT 5,CRITPATH 3,STEPS 2,EXCP 8,DEXCP 8,TEXCP 8,ESPSUB 3,
SUB# 1,SYSPLEX 8,SRVCLASS 8,OVDSUBAT 15
FROM 12AM TODAY   
  SORT EXECSDATE,EXECST     
 ENDR                                                             
/*

Thursday, September 2, 2021

CPU chargeback for MQ activity

Most MQ work is done under the user's TCB (i.e. in a Batch or CICS address space) and is hence charged to the Batch or CICS job. Some work, such as Commit processing, is done on a SRB or TCB within the QMgrand hence gets charged to the QMgraddress space.

Tuesday, August 24, 2021

What is LLA and VLF

VLF (Virtual Lookaside Facility) is an OS/390 facility that stores objects and retrieves copies when requested. In a sense it is a server. LLA is a facility that improves module fetch time by storing the module pointer in VLF. Before MVS fetches a module from disk, it asks LLA (which, in turn asks VLF) if it has a copy of the module.

VLF keeps its objects in separate address spaces; these use expanded storage (if available) or central storage and are pageable. LLA is a client of the VLF service, and deals only with load modules. Other VLF clients deal with RACF profiles, and so forth.

Member COFVLFxx in PARMLIB contains a list of all the users of VLF. LLA is one such user. Member CSVLLAxx in PARMLIB contains a list of all libraries (and/or library members) that are managed by LLA. If this member does not exist, then all LNKLST libraries are managed by default (assuming that COFVLFxx contains a statement for the CSVLLA class, to enable LLA).

The MVS operator command D LLA will display all the libraries currently managed by LLA. The list it produces is rather long, and is best used with the SDSF log display. If you change a library (add or alter a member) that is managed by LLA, you should issue the MVS operator command F LLA,REFRESH to update the LLA information. Until you do this, the system (via LLA) will continue to use the old module.

VLF and LLA are perhaps not as well documented as a new system user would like, but more information can be found in the OS/390 Initialization and Tuning Guide. You can use LLA to make your programs load faster by adding your load module library to the LLA list. This makes sense if your program is (a) fetched hundreds of times each day, (b) is not in LPA, and (c) is not in LNKLST.

Thursday, August 12, 2021

SORT table or array using COBOL SORT statement

COBOL SORT statement can also be used for sorting tables (arrays). It sorts table elements according to specified table keys.

Below is a sample program to sort a table
 
WORKING-STORAGE SECTION.                                  
01 WS-FILLER.                                             
    05 WS-TBL  OCCURS 10  TIMES.                          
        10 WS-USE-CNT     PIC 9(4)   COMP.                
01 WS-I                   PIC 9(4)   COMP.                
PROCEDURE DIVISION.                                       
   MOVE 112  TO WS-USE-CNT (1)                            
   MOVE 13   TO WS-USE-CNT (2)                            
   MOVE 55   TO WS-USE-CNT (3)                            
   MOVE 15   TO WS-USE-CNT (4)                             
   MOVE 16   TO WS-USE-CNT (5)                            
   MOVE 3    TO WS-USE-CNT (6)                            
   MOVE 43   TO WS-USE-CNT (7)                            
   MOVE 78   TO WS-USE-CNT (8)                             
   MOVE 34   TO WS-USE-CNT (9)                            
   MOVE 46   TO WS-USE-CNT (10)                           
   SORT WS-TBL ASCENDING WS-USE-CNT                       
   PERFORM VARYING WS-I FROM 1 BY 1 UNTIL WS-I > 10       
      DISPLAY WS-USE-CNT (WS-I)                           
   END-PERFORM                                            
   GOBACK.
 
Output of the above code is
 
0003
0013
0015
0016
0034
0043
0046
0055
0078
0112
 
Another example is given below
 
WORKING-STORAGE SECTION.
01 GROUP-ITEM.
05 TABL OCCURS 10 TIMES
10 ELEM-ITEM1 PIC X.
10 ELEM-ITEM2 PIC X.
10 ELEM-ITEM3 PIC X.
...
PROCEDURE DIVISION.
...
SORT TABL DESCENDING ELEM-ITEM2 ELEM-ITEM3.
 

Friday, July 30, 2021

How to screen scrap/capture multiple page Mainframe ISPF screens

Some times you may want extract the data from Mainframe ISPF screen spanning multiple pages.

In those situations, you can issue "PRINT;DOWN;RETRIEVE" command and keep press ENTER key until all the pages are printed. After that you need to sign out from TSO session and while you sign out, in the below screen you need to select option "1" to print the log dataset to the spool.

Once the print job is completed, you can direct the Spool output to a dataset and use it as per your requirement.

                      Specify Disposition of List Data Set                     

 Command ===>                                                                  

                                                                    More:     +

 List Data Set (XX05XXX.ISPF.LIST) Disposition:                                

 Process Option . . . .    1. Print data set and delete                        

                           2. Delete data set without printing                 

                           3. Keep data set - Same                             

                              (allocate same data set in next session)         

                           4. Keep data set - New                              

                              (allocate new data set in next session)          

 Batch SYSOUT class . . *                                                      

 Local printer ID or                                                            

 writer-name  . . . . .                                                        

 Local SYSOUT class . .                                                        

                                                                               

 Log Data Set Options not available                                            

                                                                                

 Press ENTER key to complete ISPF termination.                                 

 Enter END command to return to the primary option menu.                       

                                                                                

 Job statement information:  (Required for system printer)                     

  ===> //XXXXXXO JOB 'ACCOUNT ID','PRGM SCAN',MSGCLASS=X,         

  ===> //         CLASS=A,NOTIFY=&SYSUID                                        

  ===>                                                                         

SORT processing order for record handling, exits, statements, and options

The below diagram illustrates the processing order for record handling, exits, statements, and options.

Use this diagram with the text following it to understand the order DFSORT uses to run your job.

 

  1. DFSORT first checks whether you supplied a SORTIN data set for SORT and COPY jobs or SORTINnn data sets for MERGE jobs. If so, DFSORT reads the input records from them.
    • If no SORTIN data set is present for a SORT or COPY job, you must use an E15 user exit to insert all the records. (This is also true if you invoke DFSORT from a program with the address of an E15 user exit in the parameter list, because SORTIN will be ignored.) DFSORT can use a COBOL E15 routine if you specified the E15 user exit in the MODS statement.
    • If no SORTINnn data sets are present for a MERGE job, you must use an E32 user exit to insert all the records.
  2. If input records for SORT or COPY jobs are read from a SORTIN data set, DFSORT performs processing specified with the SKIPREC option. DFSORT deletes records until the SKIPREC count is satisfied. Eliminating records before a SORT or COPY gives better performance.
  3. If the input records for a SORT or COPY job are read from a SORTIN data set, DFSORT checks whether you specified an E15 user exit. If so, DFSORT transfers control to the user exit routine. You can use a COBOL E15 routine if the E15 user exit is specified in the MODS statement. The E15 routine can insert, delete, or reformat records.
  4. DFSORT performs processing specified on an INCLUDE or OMIT statement. If you used an E15 user exit routine to reformat the records, the INCLUDE/OMIT fields you specify must apply to the current format rather than to the original format. If you use the INCLUDE or OMIT statements to delete unnecessary records before SORT, MERGE, or COPY processing, your jobs run more efficiently.
  5. For SORT or COPY jobs, DFSORT performs processing specified with the STOPAFT option. Record input stops after the maximum number of records (n) you specify have been accepted. DFSORT accepts records for processing if they are:
    • Read from SORTIN or inserted by E15
    • Not deleted by SKIPREC
    • Not deleted by E15
    • Not deleted by an INCLUDE or OMIT statement.
  6. DFSORT performs processing specified in an INREC statement. Data records are parsed, edited and reformatted according to the options specified. If you reformatted the records before this step, the INREC fields you specify must apply to the current format rather than to the original format.
  7. DFSORT performs processing specified in the SORT, MERGE, or OPTION COPY statement.
    • For SORT, all input records are processed before any output record is processed.
    • For COPY or MERGE, an output record is processed after an input record is processed.
    • For SORT or MERGE, if a SUM statement is present, DFSORT processes it during the SORT or MERGE processing. DFSORT summarizes the records and deletes duplicates. If you reformatted the records before this step, the SORT or MERGE and SUM fields you specify must apply to the current format rather than to the original format.
  8. DFSORT performs processing specified in an OUTREC statement. Data records are parsed, edited and reformatted according to the options specified. If you reformatted the records before this step, the OUTREC fields you specify must apply to the current format rather than to the original format.
  9. If an E35 user exit is present, DFSORT transfers control to your user exit routine after all statement processing (except OUTFIL) is completed. If you reformatted the records, the E35 user exit receives the records in the current format rather than in the original format. You can use a COBOL E35 routine if you specify the E35 user exit in the MODS statement. You can use the E35 exit routine to add, delete, or reformat records.

    If SORTOUT and OUTFIL data sets are not present, the E35 exit must dispose of all the records because DFSORT treats these records as deleted. (This is also true if you do not specify OUTFIL data sets and DFSORT is invoked with the address of an E35 user exit in the parameter list, because SORTOUT will be ignored.)

  10. DFSORT writes your records to the SORTOUT data set, if present.
  11. DFSORT performs processing specified in one or more OUTFIL statements, if present:
    • DFSORT performs processing specified with the STARTREC, SAMPLE, and ENDREC options. Record input for the OUTFIL data sets starts with the record indicated by STARTREC, ends with the record indicated by ENDREC, and is sampled according to the records indicated by SAMPLE.
    • DFSORT performs processing specified with the INCLUDE, OMIT, or SAVE option. Records are included or omitted from the OUTFIL data sets according to the criteria specified.
    • DFSORT performs processing specified with the ACCEPT option. Record processing ends when the ACCEPT limit is reached.
    • DFSORT performs processing specified with the PARSE, OUTREC (or BUILD), OVERLAY, FINDREP, IFTHEN, FTOV, VTOF (or CONVERT), VLFILL, VLTRIM, VLTRAIL and REPEAT options. Data records are parsed, edited, reformatted, converted and repeated according to the options specified.
    • DFSORT performs processing specified with the LINES, HEADER1, TRAILER1, HEADER2, TRAILER2, SECTIONS, NODETAIL, BLKCCH1, BLKCCH2, BLKCCT1 and REMOVECC options. Data records are reformatted and report records are generated for the OUTFIL data sets.
    • DFSORT performs SPLIT, SPLITBY, or SPLIT1R processing. Records are distributed among the OUTFIL data sets as evenly as possible.
  12. DFSORT writes your OUTFIL records to the appropriate OUTFIL data sets.

Sunday, July 18, 2021

RMF post processor report to print CPU busy, MVS busy, 4HRA

The below JCL prints CPU busy, MVS busy and 4HRA

//RMFSORT EXEC PGM=SORT
//SORTIN DD DISP=SHR,DSN=SMF file...
//SORTOUT DD DSN=TEMP.DTA,
// DISP=(,PASS,DELETE),UNIT=SYSDA,SPACE=(CYL,(25,25),RLSE)
//SORTWK01 DD DISP=(NEW,DELETE),UNIT=SYSDA,SPACE=(CYL,(10))
//SORTWK02 DD DISP=(NEW,DELETE),UNIT=SYSDA,SPACE=(CYL,(10))
//SORTWK03 DD DISP=(NEW,DELETE),UNIT=SYSDA,SPACE=(CYL,(10))
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(11,4,CH,A,7,4,CH,A,15,4,CH,A),EQUALS
MODS E15=(ERBPPE15,36000,,N),E35=(ERBPPE35,3000,,N)
//*
//RMFPOST EXEC PGM=ERBRMFPP,REGION=5M
//SYSABEND DD SYSOUT=*
//MFPMSGDS DD SYSOUT=*
//MFPINPUT DD DSN=TEMP.DTA,
// DISP=(OLD,DELETE)
//PPSUM001 DD SYSOUT=*
//PPPLT001 DD SYSOUT=*
//SYSIN DD *
SYSOUT(X)
OVERVIEW(REPORT)
OVW(4HRA(LACS))
OVW(CPUBSY(CPUBSY))
OVW(MVSBSY(MVSBSY))
/*

Sunday, July 11, 2021

CA Detector Batch Reporting

The batch reporting facility lets you create reports in batch from a VSAM collection data store. These reports can then be reviewed online or in print.

Below is sample JCL to generate report for Plan Activity Report

//STEP01 EXEC PGM=PTLDRIVM,PARM='EP=PDTBATCC'
//STEPLIB DD DISP=SHR,DSN=high level qualifier.CDBALOAD
// DD DISP=SHR,DSN=high level qualifier.SDSNLOAD
// DD DISP=SHR,DSN=high level qualifier.SDSNEXIT
//PTILIB DD DISP=SHR,DSN=high level qualifier.CDBALOAD
// DD DISP=SHR,DSN=high level qualifier.SDSNLOAD
// DD DISP=SHR,DSN=high level qualifier.SDSNEXIT
//PTIPARM DD DISP=SHR,DSN=high level qualifier.CDBAPARM
//SYSPRINT DD DSN=output dataset
// DISP=(NEW,CATLG,DELETE),
// DCB=(MODDSCB,RECFM=FB,BLKSIZE=0,LRECL=133,DSORG=PS),
// DATACLAS=DCTLARGE
//SYSOUT DD SYSOUT=*
//SRTMSG DD SYSOUT=*
//SYSREC DD DUMMY
//SYSIN DD *
SSID = (ssid)
DATASTORE = (datastor)
VCAT = (datastore dataset name high level qualifier)
STARTDATE = (09/13/2020)
STARTTIME = (21:00)
ENDDATE = (09/13/2020)
ENDTIME = (23:59)
PRINT = (Y)
NORMALIZE = (Y)
CONTENT = (TABLE)
FORMAT = (SUMMARY)
REPORT = (PLAN)
/*

Below is the control card for Key Plan Activity Report—Summary Format

//SYSIN DD *
SSID = (ssid)
DATASTORE = (datastor)
VCAT = (datastore dataset name high level qualifier)
STARTDATE = (03/30/2021)
STARTTIME = (00:00)
ENDDATE = (03/31/2021)
ENDTIME = (00:00)
PRINT = (Y)
NORMALIZE = (Y)
CONTENT = (TABLE)
FORMAT = (SUMMARY)
REPORT = (KEYPLAN)
KEY = (USER)
PLAN = (plan name)
//*

Below is the control card for SQL Error Report—Detail Format

//SYSIN DD *
SSID = (ssid)
DATASTORE = (datastor)
VCAT = (datastore dataset name high level qualifier)
STARTDATE = (07/01/2021)
STARTTIME = (00:00)
ENDDATE = (07/01/2021)
ENDTIME = (23:59)
PRINT = (Y)
NORMALIZE = (Y)
CONTENT = (TEXT,TABLE,INDEX)
FORMAT = (DETAIL)
REPORT = (SQLE)
SQLCODE = (551)
/*

When generating a batch report, use the following parameters to filter the report or unloaded data to a specific set of data, according to its source:

COLLID=collectionID
CONNID=threadconnID
CORRID=threadcorrID
CNAME=connectionname
CTYPE=connectiontype
EUID=userID
EUTX=transactionID
EUWN=workstationID
PACKAGE=name
PLAN=name
PROGRAM=name
SQLCODE=codes
USER=userid

Wednesday, July 7, 2021

CICS File Openstatus Enablestatus

 In CICS, the open status of a VSAM file can either be OPEN or CLOSED, and this is indicated by the OPENSTATUS attribute in the file entry in the CICS file control table. If CICS closes a file, it is also de-allocated so that it can be processed by batch jobs. A file also has an enabled status, indicated by the ENABLESTATUS attribute, which can be either ENABLED, DISABLED, or UNENABLED. The enabled status determines whether or not a CICS application program request to a VSAM file can be attempted. If a file is disabled or unenabled, CICS fails the application program request without even attempting to send the request to VSAM. If the file is enabled, CICS issues the VSAM request on behalf of the application program.

The following are the most common combinations of these two states:

OPEN, ENABLED
CLOSED, ENABLED
OPEN, DISABLED
CLOSED, DISABLED
CLOSED, UNENABLED

In the first case (OPEN, ENABLED), the file is open and available to CICS application programs and if a batch job tries to access the file, it generally fails.

In the second case (CLOSED, ENABLED), the file is closed and not allocated, but it is available to CICS programs. In this state, if your application program issues a file access request, CICS attempts to allocate then open the file. If CICS cannot allocate and open the file, it is most probably because it is allocated to a batch job, and the application program request fails. Also in this case, as long as the file is closed, it is available for access by batch jobs.

In the last three cases in the above list (OPEN, DISABLED; CLOSED, DISABLED; and CLOSED, UNENABLED), CICS fails all file control requests without even attempting them because the file is not enabled. The key difference in these three cases is that in one the file is open and in the other two it is closed. In the open case, it is allocated to CICS so that batch jobs that attempt to access the file will probably fail. In the closed cases , it is not allocated to CICS, and is available for access by batch jobs.

Note that when a file is closed to CICS, and therefore de-allocated, the file can even be deleted by a batch job.

For the most part, the DISABLED and UNENABLED states are the same. Both states prevent an application program from accessing the file. However, there is one important difference that you must take into consideration when changing the state of a file.

The only way that a file becomes unenabled is when you close the file without altering its enabled status. You can do this using the CICS BAC batch request utility, or by using the EXEC CICS SET FILE command or the CEMT SET FILE transaction. For example, if FILEA is currently open and enabled, and you issue the CEMT command SET FILE(FILEA) CLOSED, the resulting file attributes are set to CLOSED and UNENABLED. However, if the file is currently open and disabled, the same command results in the file state being set to CLOSED and DISABLED.

The difference between a disabled and an unenabled file is in how the file state is set when a closed file is subsequently opened. If a file is currently closed and disabled, and a request is made through the CICS BAC batch request utility, CICS system programming interface (SPI), or CICS CEMT command to open the file without altering its enable status attribute, the file is opened (assuming there is nothing to keep it from being opened), but its enable status remains DISABLED. On the other hand, if a file is unenabled, an open request that does not also specify an enabled status results in the file state being set to OPEN and ENABLED.

If you issue a request that alters the enable status of a file explicitly, the file ENABLESTATUS attribute is changed regardless of whether the current state is ENABLED, DISABLED, or UNENABLED.

Wednesday, May 5, 2021

4HRA resets to 1 MSU after IPL


4HRA value resets to 1 MSU after IPL.  This can be seen in RMF Monitor III.

                         RMF V2R4   CPC Capacity                   Line 1 of 16 
 Command ===>                                                  Scroll ===> CSR  
                                                                                
 Samples: 100     System: C101  Date: 04/29/21  Time: 04.33.20  Range: 100   Sec
                                                                                
 Partition:   C101       3907 Model W02                         Boost: N        
 CPC Capacity:     280   Weight % of Max: 89.6   4h Avg:    1                   
 Image Capacity:   280   WLM Capping %:    0.0   4h Max:   44   Group:   N/A    
 MT Mode IIP:      N/A   C101 % IIP:       N/A   AbsMSUCap: N   Limit:   N/A    
                                                                                
 Partition  --- MSU ---  Cap     Proc    Logical Util %   - Physical Util % -   
              Def   Act  Def      Num    Effect   Total   LPAR  Effect  Total   
                                                                                
 *CP                              8.0                      0.5    14.0   14.5   
 C101           0    36  N N N    2.0      13.1    13.2    0.1    13.1   13.2   
 C102           0     1  N N N    2.0       0.3     0.3    0.0     0.3    0.3   
 C103           0     2  N N N    2.0       0.7     0.7    0.0     0.7    0.7   
 C104           0     0  N N N    2.0       0.0     0.0    0.0     0.0    0.0   
 PHYSICAL                                                  0.3            0.3   
                                                                                
 *IFL                             0.0                      0.0     0.0    0.0   
 PHYSICAL                                                  0.0            0.0   
                                                                                
 *IIP                             8.0                      0.0     0.7    0.8 

 SYSVIEW 16.0 C101 - CPCLPAR, CPC LPAR Capacity Information  2021/04/29 05:02:40
 Command ====>                                                 Scroll *===> PAGE
 GSVX005I Beginning of data rows ---------------- Lvl 4 Row 1-14/49 Col 1-79/118
 Partition       C101  Avg Weight     895  Group n/a       4h Avg         6   2%
 CPC Capacity     280  WLM Capping%   n/a  Limit n/a       4h Max        73  27%
 Image Capacity   280                                      4h Unused    266  98%
 -------------------------------------------------------------------------------
 Cmd  Intv Time    SrvUnits SrvUTime Unused 1hMSU Pct% ...25...50...75..100     
 ____    * TOTAL   28109385 03:58:10    265     7   3%                          
 ____    1 05:02    2535136 00:03:10    224    48  18%                          
 ____    2 04:59    6095872 00:05:00    199    73  27%                          
 ____    3 04:54    4664704 00:05:00    216    56  21%                          
 ____    4 04:49    3440832 00:05:00    231    41  15%                          
 ____    5 04:44    4042528 00:05:00    223    49  18%                          
 ____    6 04:39    3595040 00:05:00    229    43  16%                          
 ____    7 04:34    3735232 00:05:00    227    45  17%                          
 ____    8 04:29          1 00:04:59    280                                     
 ____    9 04:24          1 00:04:59    280                                     
 ____   10 04:19          1 00:04:59    280                                     
 ____   11 04:14          1 00:04:59    280                                     
 ____   12 04:09          1 00:04:59    280                                     
 ____   13 04:04          1 00:04:59    280                                     
 ____   14 03:59          1 00:04:59    280                                     
 ____   15 03:54          1 00:04:59    280                                     
 ____   16 03:49          1 00:04:59    280                                     
 ____   17 03:44          1 00:04:59    280                                     
 ____   18 03:39          1 00:04:59    280                                     
 ____   19 03:34          1 00:04:59    280                                     
 ____   20 03:29          1 00:04:59    280                                     
 ____   21 03:24          1 00:04:59    280                                     
 ____   22 03:19          1 00:04:59    280                                     
 ____   23 03:14          1 00:04:59    280                                     
 ____   24 03:09          1 00:04:59    280                                     
 ____   25 03:04          1 00:04:59    280                                     
 ____   26 02:59          1 00:04:59    280                                     
 ____   27 02:54          1 00:04:59    280                                     
 ____   28 02:49          1 00:04:59    280                                     
 ____   29 02:44          1 00:04:59    280                                     
 ____   30 02:39          1 00:04:59    280                                     
 ____   31 02:34          1 00:04:59    280                                     
 ____   32 02:29          1 00:04:59    280                                     
 ____   33 02:24          1 00:04:59    280                                     
 ____   34 02:19          1 00:04:59    280                                     
 ____   35 02:14          1 00:04:59    280                                     
 ____   36 02:09          1 00:04:59    280                                     
 ____   37 02:04          1 00:04:59    280                                     
 ____   38 01:59          1 00:04:59    280                                     
 ____   39 01:54          1 00:04:59    280                                     
 ____   40 01:49          1 00:04:59    280                                     
 ____   41 01:44          1 00:04:59    280                                     
 ____   42 01:39          1 00:04:59    280                                     
 ____   43 01:34          1 00:04:59    280                                     
 ____   44 01:29          1 00:04:59    280                                     
 ____   45 01:24          1 00:04:59    280                                     
 ____   46 01:19          1 00:04:59    280                                     
 ____   47 01:14          1 00:04:59    280                                     
 ____   48 01:09          1 00:04:59    280                                     
 ********************************* End of Data *********************************