HomeCobolPro FeaturesPowerJCL FeaturesJCLScript FeaturesContact E-JCLDeveloper Biographies

JCLScript Features and Benefits

 

When validating and analyzing IBM z/OS Job Control Language (JCL), JCLScript provides numerous features and high-level programming language constructs for complementing, customizing and extending PowerJCL's extensive default processing capabilities, including:

  • Numerous syntactical constructs suitable for high-level structured programming: IF/ELSE/ENDIF, CASE/ENDCASE, PERFORM/GOBACK, SET, GOTO, DOWHILE/ENDDO, REPEAT/UNTIL, PUSH/POP stack, DISPLAY/PRINT, EXEC, etc.

  • Capability of evaluating highly complex and arbitrary conditional expressions including pattern matching expressions and class conditional tests.

  • Highly efficient interpretive execution using static and dynamic(symbolic) variables residing in extensible virtual storage or an extensible dataspace.

  • Capability of executing programs (load modules), REXX procedures, CLIST procedures, utilities (i.e., SORT), etc. and passing/returning user-defined parameters using the polymorphic EXEC statement. All default ddnames (SYSIN, etc.) used by PowerJCL can be dynamically changed to avoid conflicts with executed programs.

  • Seamless parameter-sharing interface to IBM's REXX general purpose programming language, including a transparent variable pool sharing capability. Other general purpose programming languages (COBOL, etc.) may also be used to further extend PowerJCL's default processing capabilities.

  • GETINFO function which can seamlessly retrieve z/OS operating system information (i.e., SPACE allocation attributes, DCB attributes, ISPF statistics, member names, directory information, creation/expiration dates, device types, etc.) relating to z/OS libraries, datasets, volumes, etc.

  • String SEARCH function which can be used to efficiently inspect JCL parameter values.

  • Capability of natively performing input/output operations (OPEN, CLOSE, GET, PUT) against z/OS library (partitioned dataset) members and sequential datasets allowing these files and members to be inspected, created and modified while validating and analyzing JCL.
  • Input/output functions include the capability of dynamically allocating z/OS datasets (DD, OUTPUT) using user-defined JCLScript file allocation variables. File allocation variables are used by the JCLScript ALLOC statement and contain the necessary JCL parameter values (e.g., DSN, DISP, etc.) to allocate files. Datasets and libraries may also be dynamically unallocated or concatenated using the JCLScript UNALLOC, CONCAT and UNCONCAT statements.

                                                  

Example

                                

JCLScript can be used to detect if any installation JCL standards have been violated. The following JCLScript example demonstrates how to determine if any program libraries specified on STEPLIB or JOBLIB DD statements are also redundantly contained in the operating system's link pack or link list areas:

                                                     

If  DD.DSN Defined
And SYS.STMTNAME = 'STEPLIB' or 'JOBLIB'
    Set i = 1
    DoWhile SYS.LINKLIB.&i Defined
      If SYS.LINKLIB.&i = DD.DSN.NAME
         Display '//' SYS.STMTNAME ' DSN=' DD.DSN.NAME
                 ' IS IN LINKLIB...'
         ExitDo
      EndIf
      Set i += 1
    EndDo
EndIf

                                                  

Example

                                    

The following JCLScript example displays any SPACE parameters that may appear on DD statements:

                                                         

    If  Sys.StmtType = 'DD'    ;JCL Statement Type = DD?
    And DD.Space Defined
*-- Display SPACE sub-parameter values individually...
        Display 'DD.Space         = ' DD.Space
        Display 'DD.Space.PriQty  = ' DD.Space.PriQty
        Display 'DD.Space.SecQty  = ' DD.Space.SecQty
        Display 'DD.Space.DirQty  = ' DD.Space.DirQty
*-- Display SPACE sub-parameter values using a DOWHILE loop...
        Set i = 0
        DoWhile  DD.Space.&i defined
          Display 'DD.Space.' &i '  = ' DD.Space.&i
          Set i += 1
        EndDo
    EndIf

                                              

Example

                               

The following JCLScript example demonstrates how a library member (specified with a DSN=library(member) JCL parameter) can be dynamically allocated using the JCLScript ALLOC statement:

                                                         

Del TEMPDD.*
Set TEMPDD.DSN.NAME    = DD.DSN.NAME
Set TEMPDD.DSN.MEMBER  = DD.DSN.MEMBER
Set TEMPDD.DISP.STATUS = 'SHR'
UnAlloc DD = TEMPDD
Alloc   DD = TEMPDD
...


The JCLScript GET statement or a utility, user program, REXX procedure, etc. can subsequently be used to read and process the individual member records. This example uses JCLScript file allocation variables to specify JCL parameters for the allocation of a library member and is equivalent to the following static JCL specification:

//TEMPDD DD DSN=dsname(member),DISP=SHR

Example

                                   

The following JCLScript example demonstrates how a temporary dataset can be dynamically allocated using the JCLScript ALLOC statement:

                                                      

del  dfsparm.*
set  dfsparm.disp.status   = 'new'
set  dfsparm.disp.normal   = 'delete'
set  dfsparm.disp.abnormal = 'delete'
set  dfsparm.space.type    = 'trk'
set  dfsparm.space.priqty  = 1
set  dfsparm.space.secqty  = 1
set  dfsparm.unit.device   = 'sysda'
set  dfsparm.dsorg         = 'ps'
set  dfsparm.recfm         = 'fb'
set  dfsparm.lrecl         = 80
set  dfsparm.blksize       = dfsparm.lrecl * 293
unAlloc dd = dfsparm
  Alloc dd = dfsparm

                                          

This example uses JCLScript file allocation variables to specify JCL parameters for the allocation of a temporary dataset and is equivalent to the following static JCL specification:

                                                         

//DFSPARM DD DISP=(NEW,DELETE,DELETE),
//        SPACE=(TRK,(1,1)),
//        UNIT=SYSDA,
//        DSORG=PS,
//        RECFM=FB,
//        LRECL=80,
//        BLKSIZE=23440

                                                 

Example

                                  

The following JCLScript example demonstrates how all JCL statement parameters and their values can be inspected using JCLScript:

                                                      

Set Stmt = Sys.StmtType
If &Stmt is not null
   Set i = 0
   DoWhile &Stmt..JCLPARM.&i Defined
     Case
     When i = 0
          Display 'JCLPARM.' &i ' = '  &Stmt..JCLPARM.&i
     When Other
          Set Parm = &Stmt..JCLPARM.&i
          Display 'JCLPARM.' &i ' = '
                       &Stmt..JCLPARM.&i
                   '=' &Stmt..&Parm
     EndCase
     Set i += 1
   EndDo
EndIf

                                          

This example uses several JCLScript system and JCL variables (stmttype.JCLPARM.nn, etc.) to access JCL parameters and will display output similar to the following:

                                           

JCL statement:

//       SET UNIT=SYSDA
//ddname DD DSN=dsname,
//       DISP=(NEW,CATLG,DELETE),
//       UNIT=&UNIT,
//       SPACE=(CYL,(3,3),RLSE),
//       DCB=(RECFM=FB,LRECL=1000,BLKSIZE=0)

JCLScript output:

JCLPARM.0 = 5
JCLPARM.1 = DSN=
dsname
JCLPARM.2 = DISP=(NEW,CATLG,DELETE)
JCLPARM.3 = UNIT=SYSDA
JCLPARM.4 = SPACE=(CYL,(3,3),RLSE)
JCLPARM.5 = DCB=(RECFM=FB,LRECL=1000,BLKSIZE=0)

Example

                                                         

The following JCLScript example uses a computation from “Frequently Asked Questions about Calendarsto calculate the current day of week:

                                              

Set year  = sys.date.year    ;yyyy
Set month = sys.date.month   ;mm
Set day   = sys.date.day     ;dd
Perform GetDay
...
Exit

:GetDay
Set weekday.0 = 'Sunday'
Set weekday.1 = 'Monday'
Set weekday.2 = 'Tuesday'
Set weekday.3 = 'Wednesday'
Set weekday.4 = 'Thursday'
Set weekday.5 = 'Friday'
Set weekday.6 = 'Saturday'
Set a = (14 - month) / 12
Set y = year - a
Set m = month + 12*a - 2
Set d = (day + y + y/4 - y/100 + y/400 + (31*m)/12) % 7
Display 'Day of Week = ' weekday.&d
GoBack

                                              

Example

                                  

The following JCLScript example demonstrates how the library names and the individual name segments specified on a JCLLIB statement can be inspected for conformance to installation JCL standards:

                                   

If  SYS.STMTTYPE = 'JCLLIB'
And JCLLIB.ORDER Defined
    Set i = 0
    DoWhile JCLLIB.ORDER.&i Defined
      Display 'DSN.' &i ' = ' JCLLIB.ORDER.&i
      Set j = 0
      DoWhile JCLLIB.ORDER.&i..&j Defined
        Display 'SEGMENT.' &j ' = ' JCLLIB.ORDER.&i..&j
        Set j += 1
      EndDo
      Set i += 1
    EndDo
EndIf

 

This example uses the JCLLIB.ORDER.nn variables to access JCLLIB statement library names and name segments.

   

E-JCL Software, Inc. is an IBM Business Partner.

Copyright © 2014 E-JCL Software, Inc. All rights reserved.