Search This Blog

Monday, 30 January 2012

some imp

http://srinivasd-mainframes.blogspot.com/ {srinu's blog}

http://srinimf.wordpress.com/2011/12/31/happy-new-year-2012/ (srinu's blog)

http://mainframe-mainframes.blogspot.com/2009/07/mainframe-mainframe-programming.html

http://mainframethebigiron.blogspot.com/2011/12/cobol-interview-questions.html

http://mainframethebigiron.blogspot.com/search/label/Mainframe%20Training%20Videos

http://mainframe-tech-endevor.blogspot.com/

http://developers-arena.blogspot.com/2010/03/coding-recfmf-over-recfmfb.html


http://knowmainframe.blogspot.com/search?updated-max=2011-09-22T01:16:00%2B05:30&max-results=1
http://mainframethebigiron.blogspot.com/search/label/Endevor

http://www.indeed.com/r/38d157e7a77e1d5c

http://mainframethebigiron.blogspot.com/search/label/CICS?updated-max=2011-12-07T08:44:00-08:00&max-results=20

http://mainframeqns.wordpress.com/2011/08/31/mainframe-refresher/


http://infotech.wsu.edu/help/appServices/endevor/examples.html

http://infotech.wsu.edu/help/appServices/endevor.html
http://www.esnips.com/displayimage.php?pid=11326388

http://www.ncdhhs.gov/dirm/team51/endevor/faq01.html

http://www.grandsysteme.com/

http://publib.boulder.ibm.com/infocenter/zos/basics/index.jsp?topic=/com.ibm.zos.zappldev/zappldev_4.htm

ibm search in site:
http://www.ibm.com/search/csass/search?sn=mh&q=inquery%20form%20application%20program%20in%20mainframe&lang=en&cc=us&en=utf


http://mainframeindia.com/viewtopic.php?t=264&sid=40b55f0f47cb70bdb9d469959849ec04
http://publib.boulder.ibm.com/infocenter/zos/basics/index.jsp?topic=/com.ibm.zos.zmainframe/zconc_onlinetrans.htm

http://ibmmainframes.com/about50769-15.html  (ice tool)
http://mainframewizard.com/content/how-run-jcl-using-cobol


Application Developement

Application designers and programmers

Application programming on z/OS

The application designer gathers requirements from business systems analysts and end users. The application programmer is responsible for developing and maintaining application programs.

The tasks of designing an application and developing one are distinct enough to treat each in a separate learning module. In larger z/OS® sites, separate departments might be used to carry out each task. This section provides an overview of these job roles and shows how each skill fits into the overall view of a typical application development life cycle on z/OS.

The application designer is responsible for determining the best programming solution for an important business requirement. The success of any design depends in part on the designer's knowledge of the business itself, awareness of other roles in the mainframe organization such as programming and database design, and understanding of the business's hardware and software. In short, the designer must have a global view of the entire project.

Another role involved in this process is the business systems analyst. This person is responsible for working with users in a particular department (accounting, sales, production control, manufacturing, and so on) to identify business needs for the application. Like the application designer, the business systems analyst requires a broad understanding of the organization's business goals, and the capabilities of the information system.

The application designer gathers requirements from business systems analysts and end users. The designer also determines which IT resources will be available to support the application. The application designer then writes the design specifications for the application programmers to implement.

The application programmer is responsible for developing and maintaining application programs. That is, the programmer builds, tests, and delivers the application programs that run on the mainframe for the end users. Based on the application designer's specifications, the programmer constructs an application program using a variety of tools. The build process includes many iterations of code changes and compiles, application builds, and unit testing.

During the development process, the designer and programmer must interact with other roles in the enterprise. The programmer, for example, often works on a team of other programmers who are building code for related application modules.

When the application modules are completed, they are passed through a testing process that can include functional, integration, and system tests. Following this testing process, the application programs must be acceptance-tested by the user community to determine whether the code actually accomplishes what the users desire.

Besides creating new application code, the programmer is responsible for maintaining and enhancing the company's existing mainframe applications. In fact, this is frequently the primary job for many application programmers on the mainframe today. While many mainframe installations still create new programs with COBOL or PL/I, languages such as Java™ have become popular for building new applications on the mainframe, just as on distributed platforms.
Parent topic: Designing and developing applications for z/OS

Designing an application for z/OS

Application programming on z/OS

During the early design phases, the application designer makes decisions regarding the characteristics of the application. These decisions are based on many criteria, which must be gathered and examined in detail to arrive at a solution that is acceptable to the user. The decisions are not independent of each other, in that one decision will have an impact on others and all decisions must be made taking into account the scope of the project and its constraints.

Designing an application to run on z/OS® shares many of the steps followed for designing an application to run on other platforms, including the distributed environment. z/OS, however, introduces some special considerations. This section provides some examples of the decisions that the z/OS application designer makes during the design process for a given application. The list is not meant to be exhaustive, but rather to give you an idea of the process involved:

    Designing for z/OS: Batch or online?
    Designing for z/OS: Data sources and access methods
    Designing for z/OS: Availability and workload requirements
    Designing for z/OS: Exception handling.

Beyond these decisions, other factors that might influence the design of a z/OS application might include the choice of one or more programming languages and development environments. Other considerations discussed in this section include the following:

    Using mainframe character sets
    Using an interactive development environment (IDE)
    Differences between the various programming languages.

Keep in mind that the best designs are those that start with the end result in mind. We must know what it is that we are striving for before we start to design.

Designing for z/OS: Batch or online?

When designing an application for z/OS and the mainframe, a key consideration is whether the application will run as a batch program or an online program. In some cases, the decision is obvious, but most applications can be designed to fit either paradigm. How, then, does the designer decide which approach to use?

Reasons for using batch or online:

    Reasons for using batch:
        Data is stored on tape.
        Transactions are submitted for overnight processing.
        User does not require online access to data.
    Reasons for using online:
        User requires online access to data.
        High response time requirements.

Designing for z/OS: Data sources and access methods

Here, the designer's considerations typically include the following:

    What data must be stored?
    How will the data be accessed? This includes a choice of access method.
    Are the requests ad hoc or predictable?
    Will we choose PDS, VSAM, or a database management system (DBMS) such as DB2®?

Designing for z/OS: Availability and workload requirements

For an application that will run on z/OS, the designer must be able to answer the following questions:

    What is the quantity of data to store and access?
    Is there a need to share the data?
    What are the response time requirements?
    What are the cost constraints of the project?
    How many users will access the application at once?

What is the availability requirement of the application (24 hours a day 7 days a week or 8:00 AM to 5:00 PM weekdays, and so on)?

Designing for z/OS: Exception handling

Are there any unusual conditions that might occur? If so, we need to incorporate these in our design in order to prevent failures in the final application. We cannot always assume, for example, that input will always be entered as expected.
Parent topic: Designing and developing applications for z/OS
Related information
The EBCDIC character set
Application development tools
Designing and developing applications for z/OS
Programming languages on z/OS

Application development life cycle: An overview

Application programming on z/OS

An application is a collection of programs that satisfies certain specific requirements (resolves certain problems). The solution could reside on any platform or combination of platforms, from a hardware or operating system point of view.

As with other operating systems, application development on z/OS® is usually composed of the following phases:

    Design phase
    Gather requirements.
        User, hardware and software requirements
        Perform analysis.
        Develop the design in its various iterations:
            High-level design
            Detailed design
        Hand over the design to application programmers.
    Code and test application.
    Perform user tests.

User tests application for functionality and usability.

    Perform system tests.
        Perform integration test (test application with other programs to verify that all programs continue to function as expected).
        Perform performance (volume) test using production data.
    Go into production–hand off to operations.
    Ensure that all documentation is in place (user training, operation procedures).
    Maintenance phase--ongoing day-to-day changes and enhancements to application.

Figure 1 shows the process flow during the various phases of the application development life cycle.
Figure 1. Application development life cycle
Application development life cycle

Figure 2 depicts the design phase up to the point of starting development. Once all of the requirements have been gathered, analyzed, verified, and a design has been produced, we are ready to pass on the programming requirements to the application programmers.
Figure 2. Design phase
Design phase

The programmers take the design documents (programming requirements) and then proceed with the iterative process of coding, testing, revising, and testing again, as we see in Figure 3.
Figure 3. Development phase
Development phase

After the programs have been tested by the programmers, they will be part of a series of formal user and system tests. These are used to verify usability and functionality from a user point of view, as well as to verify the functions of the application within a larger framework (Figure 4).
Figure 4. Testing
Testing

The final phase in the development life cycle is to go to production and become steady state. As a prerequisite to going to production, the development team needs to provide documentation. This usually consists of user training and operational procedures. The user training familiarizes the users with the new application. The operational procedures documentation enables Operations to take over responsibility for running the application on an ongoing basis.

In production, the changes and enhancements are handled by a group (possibly the same programming group) that performs the maintenance. At this point in the life cycle of the application, changes are tightly controlled and must be rigorously tested before being implemented into production (Figure 5).
Figure 5. Production
Production

As mentioned before, to meet user requirements or solve problems, an application solution might be designed to reside on any platform or a combination of platforms. As shown in Figure 6, our specific application can be located in any of the three environments: Internet, enterprise network, or central site. The operating system must provide access to any of these environments.
Figure 6. Growing infrastructure complexity
Growing infrastructure complexity

To begin the design process, we must first assess what we need to accomplish. Based on the constraints of the project, we determine how and with what we will accomplish the goals of the project. To do so, we conduct interviews with the users (those requesting the solution to a problem) as well as the other stakeholders.

The results of these interviews should inform every subsequent stage of the life cycle of the application project. At certain stages of the project, we again call upon the users to verify that we have understood their requirements and that our solution meets their requirements. At these milestones of the project, we also ask the users to sign off on what we have done, so that we can proceed to the next step of the project.
Parent topic: Designing and developing applications for z/OS

Xpediter

Mainframe Tools ==> Xpediter

http://www.mainframesguru.com/contentcatsList.php?s_parentCatId=36

Sunday, 29 January 2012

Online project with COBOL and Rexx

Hi guys, I got one real-time processing project with COBOL and Rexx. This project is using ISPF services to invoke the load module. we say this is an ultra mini project, since we donot have any complicated code or operations in it. Since we are invoking the load module dynamically (using ispf services), we cannot use jcl to allocate the data set for our program; so I have use “PUTENV” to allocate the vsam file for our program.
Bullet points of Project.
1. using Dynamic vsam file allocation.
2. Dynamically invoking load module using rexx.
Step 1 Download source and dependant data sets
I have xmitted the binary files of the project from my mainframe and uploaded to some file sharing service, you can download the zipped files from the below link.
http://www.mediafire.com/?zlozknvj77z5vmd
Step 2 Upload binary files to mainframe and expand them
Download the zip file from the above link, unzip into your local folder. then you can upload them using a mainframe emulator or FTP service of windows or Linux. Please read the Step 2. Uploading files and Step 3 Inflating binary files of our first project from the below link.
http://mainframegeek.wordpress.com/2011/04/25/mainframe-projects/
Files contained in the Zip file
INDEXFLE.SRCE
INDEXFLE.JCLS
INDEXFLE.EXECPGM
Once you did Step 3. inflating binary files, by default the files will be stored in the below names.
TSHRCI.INDEXFLE.EXECPGM
TSHRCI.INDEXFLE.JCLS
TSHRCI.INDEXFLE.SRCE
Step 3 lets have a look on data sets.
TSHRCI.INDEXFLE.EXECPGM is a ps and it is a Rexx code which is used to invoke the load module from TSHRCI.LOAD.LIB .
Following code is the heart of our program, which is invoking indxfle (load module) from TSHRCI.LOAD.LIB pds.
address ispexec
"libdef ispllib dataset id(‘TSHRCI.LOAD.LIB’)"
pgm=indxfle
"select pgm("pgm")"
TSHRCI.INDEXFLE.JCLS is a pds and contained fillowing members
BATCHCOB
COBCPL
VSAMGEN
Batchcob and COBCPL are two different compile JCL’s for Cobol compiler. BATCHCOB Since I’ve been working on a internal mainframe connection the proc was different So I had to use a customized JCL to compile my code, they have modified IGYWCL proc according to their needs. COBCPL   This should work on almost all mainframes with Cobol ver 4.1, since its making use of default IGYWCL.
VSAMGEN. Is used to generate the Vsam file which we are using in our project. Once you executed the JCL, you can see that the following files has been generated. which is a must before executing our program.
TSHRCI.INDXFLE.FILE1
TSHRCI.INDXFLE.FILE1.DATA
TSHRCI.INDXFLE.FILE1.INDEX
/* DELETE KSDS CLUSTER, IF IT EXISTS                      */
DELETE TSHRCI.INDXFLE.FILE1 CLUSTER PURGE
/* DEFINE KSDS CLUSTER                                    */
DEFINE CLUSTER (                                          –
NAME(TSHRCI.INDXFLE.FILE1)                   –
VOLUMES(ETRU06)                              –
RECORDSIZE(80 80)                            –
RECORDS(50 10)                               –
KEYS(02 0)                                   –
INDEXED )                                    –
DATA (                                             –
NAME(TSHRCI.INDXFLE.FILE1.DATA) )            –
INDEX (                                            –
NAME(TSHRCI.INDXFLE.FILE1.INDEX) )
IF LASTCC = 0 THEN                                        –
LISTCAT ALL LEVEL(TSHRCI.INDXFLE)
Above code is the important part of VSAMGEN, It will delete vsam cluster if existing, create new cluster, index and data data sets.If you are running the JCL for the first time you will get Maxcc 8, since cluster is not existing in system. The line which marked in red color is not mandatory if your mainframe is  SMS managed. “ETRU06” is the DASD vol ser# where we need our vsam file. Read Redbook on below link to know more about SMS.
http://www.redbooks.ibm.com/abstracts/sg245484.html
TSHRCI.INDEXFLE.SRCE, is a pds and contained “INDXFLE” which is source code of our project. As I said this project is very small and does not have any complicated logics or functionalities in it. The advantages are we are using Dynamic vsam file allocation and invoking load module dynamically using ispexec service.
Step 4 Key parts of Program.
Dynamic File allocation.
01  FILE-DATA.
05  FILE-PTR                POINTER.
05  FILE-NAME.
10                      PIC X(12)
VALUE ‘DYNVSAM=DSN(‘.
10  dsname              PIC X(60).
10                      PIC XX VALUE Z’ ‘.
05  RC                      PIC S9(9) BINARY VALUE 0.
05  in-name                 pic x(40).
In order to allocate file, we need to tell which file we need to allocate and how we need to do it (Disp) So we need to have the above code in working storage section. once the allocation is done the return code (from PUTENV) will be stores in RC. 10                      PIC XX VALUE Z’ ‘. is filler and says that it null terminated string.
move ‘TSHRCI.INDXFLE.FILE1′
to in-name.
string in-name delimited by space
‘) SHR’ delimited by size into dsname.
Above code will concatenate vsam cluster dsn with disposition and other data and move to fFILE-NAME data name.
set file-ptr                to address of file-name.
CALL ‘PUTENV’
USING BY VALUE FILE-PTR
RETURNING RC.
Above line sets the address pointer of file name to FILE-PTR and calls PUTENV using FILE-PTR. PUTENV will allocate the file wich FILE-PTR points and  return the status of allocation, which will be stored in RC, if RC is –1 then allocation was failure, 0 means allocation was success.
Step 5. Compile and execute the program
Compile
Run BATCHCOB and JCL should return MAXCC 0, and will happen with the provided source code.
Create TSHRCI.LOAD.LIB if not existing before you compile the project.
Executing project
Execute TSHRCI.INDEXFLE.EXECPGM rexx code by putting an “EX” before the file name.
image
and Press Enter which will invoke INDXFLE from TSHRCI.LOAD.LIB, if the compilation was failure then which will give you an error. Please verify that you have created TSHRCI.,LOAD.LIB before compiling the source code and the compilation was successful.
image
Its the fist line in our Project which is to bring up the options in a brand new screen, press enter to continue.
image
Chose any of the options by entering the number and hit enter.
image
image
image
image
image
press enter to come out of this screen. When ever we are performing some actions on data set, our program will set the return code of our Project based on the file status. And the rexx code will evaluate the return code of the project.
image
Advertisement

DSNTIAR & DSNTIAC–SQLCA formatter for Batch & CICS

We must check for the SQLCODE before we issue commit on a table in DB2, handle the errors- Display description or whatever. handling/remembering reason for each and every sqlcode every time is a time pressing task always. There is DSNTIAR and DSNTIAC comes in picture. DSNTIAR and DSNTIAC are two assembler routine which helps to get a formatted version of SQLCA and the text message based on the sqlcode in the SQLCA.
DSNTIAR takes data from SQLCA formats and puts into a data area provided by the calling program. DSNTIAR will overwrite the contents of the data area before it moves the data.
DSTIAR expects the SQLCA in its original for, so before you call DSNTIAR/DSNTIAC make sure that you haven’t modified SQLCA.
Defining Message output Data name
Calling program must allocate output message data name and pass it,
make sure:
1. First 2 bytes are length – a pic s9(4) comp will be ideal for the purpose.
2.You must define enough space for the message in character type, data should be minimum of 10 lines of 72 bytes. A  PIC x(72)  occurs 10 times. will  be quite enough for the message.
e.g.
01  ERROR-MESSAGE.                                
        02  ERROR-LEN   PIC S9(4)  COMP VALUE +720.
        02  ERROR-TEXT  PIC X(72)  OCCURS 10 TIMES.

keep the length in another variable.
77  ERROR-TEXT-LEN      PIC S9(9)  COMP VALUE +72.
Once we executed a SQL statement, we are ready to issue a call to DSNTIAR,
CALL ‘DSNTIAR’ USING SQLCA ERROR-MESSAGE ERROR-TEXT-LEN
display the resultant message by displaying “ ERROR-TEXT() “ table.
Possible return codes for DSNTIAR/DSNTIAC
0 Successful execution.
4 More data available than could fit into the provided message area.
8 Error record length is not between 72 & 240
12 Message area is not large enough,  we need to provide more space needs to be defined and must be passed.
16 Error in message routine.

Sample program
IDENTIFICATION DIVISION.                                        
PROGRAM-ID. DBPGM01.                                            
AUTHOR    . SHIBU.T.                                            
*                                                                
DATA DIVISION.                                                  
WORKING-STORAGE SECTION.                                        
     EXEC SQL                                                    
         INCLUDE MYNAM                                           
     END-EXEC.                                                   
     EXEC SQL                                                    
         INCLUDE SQLCA                                           
     END-EXEC.                                                   
                                                                 
01  ERROR-MESSAGE.                                              
         02  ERROR-LEN   PIC S9(4)  COMP VALUE +720.             
         02  ERROR-TEXT  PIC X(72)  OCCURS 10 TIMES.             
77  ERROR-TEXT-LEN      PIC S9(9)  COMP VALUE +72.              
                                                                 
01  WS-TEMP-VAR.                                                
     05  TEMP                    PIC X(30).                      
     05  TEMP-MSG                PIC X(60).                      
     05  WS-IND                  PIC X VALUE ‘Y’.                
01  WS-TBLE-DTA.                                                
     05  WS-SEQ                  PIC X(3).                       
     05  WS-SEQ-TMP              PIC X(3).                       
     05  WS-NAME                 PIC X(15).                      
                                                                 
77  WS-I                        PIC S9(4) COMP.                 
                                                                 
01  WS-SQLCODE                  PIC ——9.                    
*                                                                
PROCEDURE DIVISION.                                             
     PERFORM A00100-READ-PARA.                                   
                                                                 
Z00100-EXIT-PARA.                                               
     STOP RUN.                                                   
A00100-READ-PARA.                                               
     DISPLAY ‘         A00100-READ-PARA.           ‘             
     EXEC SQL                                                   
         DECLARE CURREAD1 CURSOR FOR                            
             SELECT NAME,SEQ FROM IBMGRP.MYNAM                  
     END-EXEC.                                                  
     EXEC SQL                                                   
        OPEN CURREAD1                                           
     END-EXEC.                                                  
     EVALUATE TRUE                                              
     WHEN SQLCODE = 0                                           
      PERFORM A00150-READ-PARA                                  
     WHEN SQLCODE > 0                                           
      DISPLAY ‘FETCH WAS SUCCESS WITH A WARNING’                
      CALL ‘DSNTIAR’ USING SQLCA ERROR-MESSAGE ERROR-TEXT-LEN   
      PERFORM VARYING WS-I FROM 1 BY 1 UNTIL WS-I = 10          
        DISPLAY ERROR-TEXT(WS-I)                                
      END-PERFORM                                               
     WHEN OTHER                                                 
      CALL ‘DSNTIAR’ USING SQLCA ERROR-MESSAGE ERROR-TEXT-LEN   
      PERFORM VARYING WS-I FROM 1 BY 1 UNTIL WS-I = 10          
        DISPLAY ERROR-TEXT(WS-I)                                
      END-PERFORM                                               
      PERFORM Z00100-EXIT-PARA                                  
     END-EVALUATE.                                              
     MOVE SQLCODE             TO WS-SQLCODE.                    
     DISPLAY ‘SQLCODE OPEN  ‘ WS-SQLCODE.                       
A00150-READ-PARA.                                              
     DISPLAY ‘****DATA FROM TABLE***’                           
     PERFORM UNTIL SQLCODE = 100                                
        EXEC SQL                                                
           FETCH CURREAD1 INTO :WS-NAME,:WS-SEQ                 
        END-EXEC                                                
        MOVE SQLCODE             TO WS-SQLCODE                  
        EVALUATE TRUE                                           
        WHEN SQLCODE = 0                                        
         MOVE SPACES TO TEMP-MSG                                
         STRING                                                 
         ‘NAME: ‘ DELIMITED BY SPACE ‘ ‘ DELIMITED BY SIZE      
         WS-NAME DELIMITED BY SPACE ‘,’ DELIMITED BY SIZE       
         ‘SEQ#’ DELIMITED BY SPACE ‘ ‘ DELIMITED BY SIZE        
         WS-SEQ DELIMITED BY SIZE INTO TEMP-MSG                 
         DISPLAY TEMP-MSG                                       
        WHEN  SQLCODE > 0                                       
         DISPLAY ‘FETCH WAS SUCCESS WITH A WARNING’             
         CALL ‘DSNTIAR’ USING SQLCA ERROR-MESSAGE ERROR-TEXT-LEN
         PERFORM VARYING WS-I FROM 1 BY 1 UNTIL WS-I = 10       
         DISPLAY ERROR-TEXT(WS-I)                               
      END-PERFORM                                               
        WHEN OTHER                                              
         CALL ‘DSNTIAR’ USING SQLCA ERROR-MESSAGE ERROR-TEXT-LEN
         PERFORM VARYING WS-I FROM 1 BY 1 UNTIL WS-I = 10       
           DISPLAY ERROR-TEXT(WS-I)                             
         END-PERFORM                                            
         PERFORM Z00100-EXIT-PARA                               
        END-EVALUATE                                            
     END-PERFORM.                                               
     DISPLAY ‘****END OF TABLE DATA****’                        
     EXEC SQL                                                   
        CLOSE CURREAD1                                          
     END-EXEC.                                                  
     MOVE SQLCODE             TO WS-SQLCODE.                    
     DISPLAY ‘SQLCODE CLOSE ‘ WS-SQLCODE.                       
     EXIT                                                       
     .                                                          

Compiling and link editing.
remember you must concatenate <HLQ>.SDSNLOAD of DB2 installed in your host mainframe to the STEPLIB of compile step, otherwise it will result in DSNTIAR module not found error while compiling. Read http://mainframegeek.wordpress.com/2011/05/12/steps-in-a-cobol-db2-program/ for the jcl for compile, link edit and exec ut the DB2 cobol program. Don’t forget to change the JCL as mentioned below.
e.g.
//DB2COBA JOB (12345678),MSGCLASS=H,REGION=4M,                        
//        MSGLEVEL=(1,1),CLASS=A,NOTIFY=&SYSUID                       
//*                                                                   
//JOBLIB    DD DSN=DSN910.DB9G.SDSNEXIT,DISP=SHR                      
//          DD DSN=DSN910.SDSNLOAD,DISP=SHR                           
//*****************************************************************   
//* SQL PREPROC AND COBOL COMPILATION:                                
//*****************************************************************   
//*-NB—SQL PREPROC NOW IS NOW DONE BY THE COBOL COMPILER:           
//*****************************************************************   
//COB     EXEC  PGM=IGYCRCTL,                                         
//            PARM=(SQL,LIB,NOTERM,NOSEQUENCE,LIB,XREF,DYN,”)        
//STEPLIB   DD DSN=IGY410.SIGYCOMP,DISP=SHR                           
//          DD DSN=DSN910.SDSNLOAD,DISP=SHR                           
//DBRMLIB   DD DSN=TSHRCI.PGMG.DBRM(DBPGM02),DISP=SHR                 
//SYSIN     DD DSN=TSHRCI.PGMG.COBOL1(DBPGM02),DISP=SHR               
//SYSLIB    DD DSN=TSHRCI.PGMG.COBOL1,DISP=SHR                        
//SYSLIN    DD DSN=&&LOADSET,DISP=(MOD,PASS),UNIT=SYSDA,              
//             SPACE=(800,(500,500))                                  
//SYSPRINT  DD SYSOUT=*                                               
//SYSUDUMP  DD SYSOUT=*                                               
//SYSUT1    DD SPACE=(800,(500,500),,,ROUND),UNIT=SYSDA               
//SYSUT2    DD SPACE=(800,(500,500),,,ROUND),UNIT=SYSDA               
//SYSUT3    DD SPACE=(800,(500,500),,,ROUND),UNIT=SYSDA               
//SYSUT4    DD SPACE=(800,(500,500),,,ROUND),UNIT=SYSDA               
//SYSUT5    DD SPACE=(800,(500,500),,,ROUND),UNIT=SYSDA               
//SYSUT6    DD SPACE=(800,(500,500),,,ROUND),UNIT=SYSDA               
//SYSUT7    DD SPACE=(800,(500,500),,,ROUND),UNIT=SYSDA               
//*****************************************************************
   
Outputs.
image
Advertisement

Submitting Batch JOB( JCL) from CICS Online program

How do we submit JCL’s from CICS Online program?, we can use a TDQ or CICS SPOOL Verbs. So how these CICS SPOOL Verbs differs  from  TDQ?. The problem with TDQ is that in most of the sites, application developers are not authorized to create TDQ (its sysadmin task ) , not that much flexible, and we are responsible to read TDQ sequentially . So thats how CICS JES  commands  comes into picture. We can read the Spool data and write into spool. today we are gonna look only submitting the jobs.
The JES-CICS interface is totally depends on SPOOL initialization parm of CICS TS, check with your sysadmin guys whether CICS SPOOL parm is YES or NO. To use JES-CICS, SPOOL keyword must be YES.
Submitting a batch job has 3 steps
1. SPOOLOPEN OUTPUT
We are opening SPOOL for submitting JCL, we need to provide USERID and need to store TOKEN for the connection. We must use the same token till we close the spool. The userId is not RACF ID it must be INTRDR (Internal reader), the token is a 8 bit alphanumeric dataname (PIC x(8).
Snippet.
EXEC CICS SPOOLOPEN OUTPUT 
   NODE(‘LOCAL’)           
   USERID(‘INTRDR’)        
   TOKEN(WS-TOKEN)         
   RESP(WS-RESP)           
END-EXEC.                 
2. SPOOLWRITE
Is for writing the lines of JCL statements into spool with INTRDR. we should define the data name which holds the JCL statements as a 80 bit length Alpha numeric field (PIC X(80). we must provide the length in FLENGTH of SPOOLWRITE. we must provide the token which we got when we opened spool.
Snippet.
EXEC CICS SPOOLWRITE                   
     FROM(WS-LINE(WS-CNTR))            
     FLENGTH(LENGTH OF WS-LINE(WS-CNTR))
     RESP(WS-RESP)                     
     TOKEN(WS-TOKEN)                   
END-EXEC                              
3. SPOOLCLOSE
Okay, we have written our jcl statements to JES; now we need to close the spool connection so the JCL will get submitted. we must provide the token which we got when we opened spool.
Snippet.
EXEC CICS SPOOLCLOSE
   RESP(WS-RESP)   
   TOKEN(WS-TOKEN) 
END-EXEC.         
Common Abends/Errors.
1. ALLOCERROR
occurs when Dynamic allocation rejected request to allocate input dataset.
2. INVREQ
Can occur if any of the following happens. Unsupported function, Unsupported language, From dataname is missing etc.
3. SPOLBUSY
JES interface is used by another task.
4. LENGERR
Happens when the from dataname contents and FLENGTH value are mismatching, we can always make use of  ‘LENGTH OF’ keyword to avoid this.
5. NOTOPEN
Spool report has not been opened.
finally
6 NOSPOOL
this happens when we have no JES subsystem.
Sample program for Submitting JCL from CICS
IDENTIFICATION DIVISION.                                    
PROGRAM-ID. SPOOL01.                                        
AUTHOR.     SHIBU.T.                                        
*                                                            
DATA DIVISION.                                              
WORKING-STORAGE SECTION.                                    
01  WS-JCL.                                                 
     05  WS-LINE                 PIC X(80) OCCURS 13 TIMES.  
01  WS-TEMP.                                                
     05  WS-MSG                  PIC X(40).                  
     05  WS-RESP                 PIC S9(8) COMP.             
     05  WS-CNTR                 PIC S9(4) COMP.             
     05  WS-TOKEN                PIC X(8).                   
COPY DFHAID.                                                
*                                                            
PROCEDURE DIVISION.                                         
A00100-MAIN-PARA.                                           
     MOVE LOW-VALUES             TO WS-JCL.                  
     MOVE ‘TEST MESSAGE’         TO WS-MSG.                  
     MOVE ‘//R0318BJJ  JOB REGION=0M’                        
                                 TO WS-LINE(1).              
     MOVE ‘//MODEL    EXEC PGM=IEFBR14′                      
                                 TO WS-LINE(2).              
     MOVE ‘//JPAYSLP DD DSN=TSHRCI.PAYROLL.PAYSLIP.GROUP(+1),’
                                 TO WS-LINE(4).              
     MOVE ‘//            DISP=(NEW,CATLG,DELETE),’           
                                 TO WS-LINE(5).              
     MOVE ‘//            SPACE=(TRK,5),’                     
                                 TO WS-LINE(6).              
     MOVE ‘//            DCB=TSHRCI.PAYROLL.PAYSLIP.MODEL,’  
                                 TO WS-LINE(7).              
     MOVE ‘//*           VOL=SER=ETRU04,’                    
                                 TO WS-LINE(8).              
     MOVE ‘//            UNIT=SYSDA’                         
                                 TO WS-LINE(9).              
     MOVE ‘//SYSIN     DD   *’   TO WS-LINE(10).             
     MOVE ‘//SYSPRINT DD   SYSOUT=*’                         
                                 TO WS-LINE(11).         
     MOVE ‘/*’                   TO WS-LINE(12).         
     MOVE ‘//’                   TO WS-LINE(13).         
     EXEC CICS SEND                                      
        FROM(WS-MSG)                                     
        LENGTH(LENGTH OF WS-MSG)                         
     END-EXEC.                                           
* OPEN SPOOL.                                            
     EXEC CICS SPOOLOPEN OUTPUT                          
        NODE(‘LOCAL’)                                    
        USERID(‘INTRDR’)                                 
        TOKEN(WS-TOKEN)                                  
        RESP(WS-RESP)                                    
     END-EXEC.                                           
     IF WS-RESP NOT = DFHRESP(NORMAL)                    
        MOVE SPACES              TO WS-MSG               
        MOVE ‘* OPEN SPOOL.’     TO WS-MSG               
        EXEC CICS SEND                                   
        ERASE                                            
           FROM(WS-MSG)                                  
           LENGTH(LENGTH OF WS-MSG)                      
        END-EXEC                                         
        PERFORM Z00100-EXIT-PARA                         
     END-IF.                                             
* WRITE RECORDS INTO SPOOL                               
     PERFORM VARYING WS-CNTR FROM 1 BY 1 UNTIL           
             WS-CNTR = 14                                
        EXEC CICS SPOOLWRITE                             
             FROM(WS-LINE(WS-CNTR))                      
             FLENGTH(LENGTH OF WS-LINE(WS-CNTR))         
             RESP(WS-RESP)                               
             TOKEN(WS-TOKEN)                             
        END-EXEC                                         
     END-PERFORM.                                        
     IF WS-RESP NOT = DFHRESP(NORMAL)                    
        MOVE SPACES              TO WS-MSG               
        MOVE ‘* WRITE JCL ‘      TO WS-MSG               
        EXEC CICS SEND                                   
        ERASE                                           
           FROM(WS-MSG)                                 
           LENGTH(LENGTH OF WS-MSG)                     
        END-EXEC                                        
        PERFORM Z00100-EXIT-PARA                        
     END-IF.                                            
* CLOSE SPOOL                                           
     EXEC CICS SPOOLCLOSE                               
        RESP(WS-RESP)                                   
        TOKEN(WS-TOKEN)                                 
     END-EXEC.                                          
     IF WS-RESP NOT = DFHRESP(NORMAL)                   
        MOVE SPACES              TO WS-MSG              
        MOVE ‘* CLOSE SPOOL’     TO WS-MSG              
        EXEC CICS SEND                                  
        ERASE                                           
           FROM(WS-MSG)                                 
           LENGTH(LENGTH OF WS-MSG)                     
        END-EXEC                                        
     END-IF.                                            
        PERFORM Z00100-EXIT-PARA.                       
*                                                       
Z00100-EXIT-PARA.                                      
     EXEC CICS RETURN                                   
     END-EXEC.    

When the application finished the execution you can see the job in SPOOL ( with SDSF or whatever).
image
Advertisement