Previous Topic: DROP PLAN (DBSQLPR)Next Topic: Sample Report


Example JCL

Note: Users of z/OS can use either spaces or commas as parameter separators in the PARM= input parameter string in the JCL. In z/VSE environments, the SYSLST file must be assigned to a POWER-controlled print device, and parameter separators in the PARM= input parameter string must be spaces.

Following is an example PARM= input parameter string specification.

         PARM='PRTWIDTH=255,INPUTWIDTH=72,PAGELEN=56,TBLHDRRPT=56'

The PARM= input parameter string is limited by IBM to 100 bytes. Following is an example in which lines have been spanned. Be aware that the first line ends in column 71 and the second line starts in column 16.

         PARM='PRTWIDTH=255,INPUTWIDTH=72,ERRBORT=-56,OPTFILE=OP,ROWLI
               MIT=9'

Following is a z/OS JCL sample:

Note: Use the following as a guide to prepare your JCL. The JCL statements are for example only. Lowercase letters in a statement indicate a value you must supply. Code all statements to your site and installation standards.

 //jobname      See the note above.
 //             CLASS=K,MSGCLASS=X,REGION=1024K
 //SQLEXEC  EXEC PGM=DBSQLPR,...see Listing Libraries for CA Datacom Products
 //*
 //       PARM='prtWidth=999,inputWidth=80'
 //*
 //SYSUDUMP DD  SYSOUT=*
 //SYSPRINT DD  SYSOUT=*
 //STDERR   DD  SYSOUT=*
 //STDOUT   DD  SYSOUT=*
 //OPTIONS  DD  *
 AUTHID=SYSUSR
 /*
 //SYSIN    DD  *
 create table testTable (colChar char(18), colInt integer);
 insert into  testTable values ('colChar row 1', 1);
 insert into  testTable values ('colChar row 2', 2);
 -- Output appears as a table unless "PRTWIDTH=" is exceeded.
 select colChar, colInt from testTable;
 rollback work;
 /*

Following is sample z/VSE JCL.

Note: Use the following as a guide to prepare your JCL. The JCL statements are for example only. Lowercase letters in a statement indicate a value you must supply. Code all statements to your site and installation standards.

* $$ JOB ...           See the note above..
* $$ LST CLASS=x
// JOB     jobname
*           CREATE OPTIONS FILE USING DITTO
// UPSI 1
// EXEC    PROC=yourproc
// ASSGN   SYSnnn,DISK,VOL=volser,SHR
// DLBL    OPTIONS,'dataset.name',0,SD
// EXTENT  SYSnnn,volser,1,0,reltrk,1
// EXEC DITTO
$$DITTO CSQ FILEOUT=OPTIONS,CISIZE=512,BLKFACTOR=1
AUTHID=SYSADM
/*
$$DITTO EOJ
/*
*           EXECUTE DBSQLPR
// EXEC DBSQLPR,SIZE=AUTO
   SELECT * FROM table;
/*
/&
* $$ EOJ

Example SQL Statements

The following SQL statements can be used to determine which plans on your system were added using the @TIMESTAMP keyword in the PLANAME option of your COBOL precompiler.

If you want to get a list of all plans on your system, that have been created using the new method of specifying @TIMESTAMP in the plan name of your COBOL program, you can code the following SQL to get the list output (AUTHID=SYSADM option specified):

SELECT PRIMARY_AUTH_ID,  PRIMARY_OCC_NAM,
       HEX(SUBSTR(WORK_AREA_UPD, 81, 4)) AS SWITCHES
FROM DDD_TABLE
WHERE SQL_TYPE = 'PLN'
      AND BIT_AND(SUBSTR(WORK_AREA_UPD, 81, 1), X'02') = X'02'
ORDER BY PRIMARY_OCC_NAM
;

PRIMARY_AUTH_ID                  PRIMARY_OCC_NAM                 SWITCHES   
CHAR(32) NOT NULL                CHAR(32) NOT NULL                CHAR(8).N.N       
________________________________ ________________________________ ____________       
 SYSADM                           AVE2001_1507221647               02000000           
 SYSADM                           AVE2001_1507231147               02000000           
 SYSADM                           AVE2001_1507241436               02000000           
 SYSADM                           AVE2001L1507231147               02000000           
 SYSADM                           AVE2001L1507241436               02000000           
 SYSADM                           AVE2001L1507241441               02000000           
 SYSADM                           DAF4____1507221647               02000000           
 SYSADM                           DAF4____1507231147               02000000           
 SYSADM                           DAF4____1507241436               02000000           
 SYSADM                           DAF888881507221647               02000000           
 SYSADM                           DAF888881507231147               02000000           
 SYSADM                           DAF888881507241436               02000000           
 ___ 12 rows returned ___                                                             

If you want a list of all your plans, with a column that indicates ‘YES’ if they were added by COBOL @TIMESTAMP specification, and ‘NO’ if they were not, you can use the following SQL statement:

SELECT PRIMARY_AUTH_ID, PRIMARY_OCC_NAM,                                           
       (CASE                                                                       
         WHEN (BIT_AND(SUBSTR(WORK_AREA_UPD, 81, 1), X'02') = X'02') THEN 'YES'    
         ELSE        'NO'                                                          
         END                                                                       
       ) AS COBOL_TS                                                               
  FROM DDD_TABLE                                                                   
  WHERE SQL_TYPE = 'PLN'                                                           
  ORDER BY PRIMARY_OCC_NAM                                                         
;                                                                                  

PRIMARY_AUTH_ID                  PRIMARY_OCC_NAM                  COBOL_TS         
CHAR(32) NOT NULL                CHAR(32) NOT NULL                CHAR(3)          
________________________________ ________________________________ ________         
…
SYSUSR                           AVE1958                           NO              
SYSADM                           AVE2001                           NO 
…              
SYSADM                           AVE2001_1507221647                YES     
SYSADM                           AVE2001_1507231147                YES     
SYSADM                           AVE2001_1507241436                YES     
…
SYSADM                           AVE2001L1507231147                YES     
SYSADM                           AVE2001L1507241436                YES     
SYSADM                           AVE2001L1507241441                YES     
SYSADM                           BRM1780                           NO      
…          
SYSADM                           DAF4____1507221647                YES               
SYSADM                           DAF4____1507231147                YES               
SYSADM                           DAF4____1507241436                YES               
…      
SYSADM                           DAF888881507221647                YES               
SYSADM                           DAF888881507231147                YES               
SYSADM                           DAF888881507241436                YES               
SYSADM                           DICKTST                           NO                
SYSADM                           DICKUDFT                          NO                
SYSADM                           DICK309                           NO                
… 
___ nnn rows returned ___