Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

how to pass data from cobol program to jcl?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
praveenkesana

New User


Joined: 29 Jul 2005
Posts: 1
Location: india

PostPosted: Mon Aug 01, 2005 7:17 pm    Post subject: how to pass data from cobol program to jcl?
Reply with quote

hi all,

i have a requirement tht i need to pass data from cobol program to jcl.i mean to say tht i need to pass the output of cobol program to jcl.

for example cobol output shd be passed to symbolic parameter.

is there any possibility?

thanks,
praveen
Back to top
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4649
Location: Raleigh, NC, USA

PostPosted: Mon Aug 01, 2005 7:43 pm    Post subject: Re: how to pass data from cobol program to jcl?
Reply with quote

The only information that can be passed from a program back to the calling JCL is the 1 to 4-digit value of the RETURN-CODE register. Anything else would need to be either sent to the job's output (such as a DISPLAY statement), written to the JES spool, or written to a dataset.
Back to top
View user's profile Send private message
mrar_160

New User


Joined: 14 Sep 2005
Posts: 48

PostPosted: Fri Feb 10, 2006 2:47 pm    Post subject:
Reply with quote

Hi superk..
I still dont understand how to do..
CAn you explain detail? thank you..
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4649
Location: Raleigh, NC, USA

PostPosted: Sat Feb 11, 2006 12:57 am    Post subject: Re: how to pass data from cobol program to jcl?
Reply with quote

OK. Here's a small example. This program sets the RETURN-CODE value to a number that represents the current day of the week (1=Monday, 2=Tuesday, etc.). I also added the logic to display this information:

1. In the JOBLOG.
2. In a JES dataset.
3. In a cataloged dataset.

Here's the program:
Code:

       IDENTIFICATION DIVISION.
       PROGRAM-ID. PROG65.
       INSTALLATION.
       AUTHOR. SUPERK.
       DATE-WRITTEN. 02/10/2006.

       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.

         FILE-CONTROL.
           SELECT OUTFILE ASSIGN TO OUT
             ORGANIZATION IS SEQUENTIAL.
           SELECT OUTPRT ASSIGN TO PRT
             ORGANIZATION IS SEQUENTIAL.

       DATA DIVISION.
       FILE SECTION.

       FD  OUTFILE
           LABEL RECORD STANDARD
           BLOCK 0 RECORDS
           RECORDING MODE F
           RECORD CONTAINS 80 CHARACTERS.

       01 OUTPUT-RECORD                PIC X(80).

       FD  OUTPRT
           LABEL RECORD STANDARD
           BLOCK 0 RECORDS
           RECORDING MODE F
           RECORD CONTAINS 80 CHARACTERS.

       01 PRINT-RECORD                 PIC X(80).

       WORKING-STORAGE SECTION.
       01  WS-OUTPUT-MESSAGE.
           03  FILLER                  PIC X(23) VALUE
           'THE DAY OF THE WEEK IS'.
           03  WS-DOW-NAME             PIC X(09) VALUE SPACES.
           03  FILLER                  PIC X(01) VALUE SPACES.
           03  FILLER                  PIC X(21) VALUE
           'WHICH IS DAY NUMBER'.
           03  WS-DOW-NUMBER           PIC X(01) VALUE SPACES.
           03  FILLER                  PIC X(25) VALUE SPACES.
       01  WS-DATE-IN                  PIC 9(06).
       01  WS-DAY-IN                   PIC 9(05).
       01  WS-DAY-OF-WEEK-IN           PIC 9(01).
       01  DAY-OF-WEEK-TEXT.
           03  WS-DAY-OF-WEEK OCCURS 7 TIMES.
               05  FILLER              PIC X(09) VALUE 'MONDAY   '.
               05  FILLER              PIC X(09) VALUE 'TUESDAY  '.
               05  FILLER              PIC X(09) VALUE 'WEDNESDAY'.
               05  FILLER              PIC X(09) VALUE 'THURSDAY '.
               05  FILLER              PIC X(09) VALUE 'FRIDAY   '.
               05  FILLER              PIC X(09) VALUE 'SATURDAY '.
               05  FILLER              PIC X(09) VALUE 'SUNDAY   '.

       PROCEDURE DIVISION.
       MAIN-PARA.
           ACCEPT WS-DATE-IN FROM DATE.
           ACCEPT WS-DAY-IN FROM DAY.
           ACCEPT WS-DAY-OF-WEEK-IN FROM DAY-OF-WEEK.
           MOVE WS-DAY-OF-WEEK(WS-DAY-OF-WEEK-IN)
             TO WS-DOW-NAME.
           MOVE WS-DAY-OF-WEEK-IN
             TO WS-DOW-NUMBER.
           DISPLAY WS-OUTPUT-MESSAGE UPON CONSOLE.
           OPEN OUTPUT OUTFILE.
           MOVE SPACES TO OUTPUT-RECORD.
           WRITE OUTPUT-RECORD FROM WS-OUTPUT-MESSAGE.
           CLOSE OUTFILE.
           OPEN OUTPUT OUTPRT.
           MOVE SPACES TO PRINT-RECORD.
           WRITE PRINT-RECORD FROM WS-OUTPUT-MESSAGE.
           CLOSE OUTPRT.
           MOVE WS-DAY-OF-WEEK-IN TO RETURN-CODE.
           STOP RUN.


And the job:
Code:

//STEP0001 EXEC PGM=PROG65                                     
//STEPLIB  DD   DISP=SHR,DSN=&SYSUID..COBOL.LOAD               
//SYSOUT   DD   SYSOUT=*                                       
//PRT      DD   SYSOUT=*                                       
//OUT      DD   DSN=&SYSUID..PROG65.OUT,                       
//         DISP=(,CATLG,DELETE),UNIT=SYSDA,                   
//         RECFM=FB,LRECL=80,SPACE=(80,(1,1),RLSE)             
//*
// IF (STEP0001.RC = 1) THEN
//STEP0002 EXEC Monday's Logic
// ELSE IF (STEP0001.RC = 2) THEM
//STEP0003 EXEC Tuesday's Logic
//...
// ENDIF


And the results:
The JESMSGLG output:
Code:

 14.13.03 JOB19327 ---- FRIDAY,    10 FEB 2006 ----
 14.13.03 JOB19327  IRR010I  USERID SUPERK   IS ASSIGNED TO THIS JOB.
 14.13.03 JOB19327  $HASP373 SUPERKZ STARTED - INIT 74    - CLASS X - SYS SYSB
 14.13.03 JOB19327  IEF403I SUPERKZ - STARTED - TIME=14.13.03
 14.13.03 JOB19327  SVM3347I SUPERKZ, STEP0001, OUT, SUPERK.PROG65.OUT BLKSIZE CHANGED 0/ 27920
 14.13.04 JOB19327  +THE DAY OF THE WEEK IS MONDAY    WHICH IS DAY NUMBER  5  <== JOBLOG Output
 14.13.04 JOB19327  IEF404I SUPERKZ - ENDED - TIME=14.13.04
 14.13.04 JOB19327  $HASP395 SUPERKZ ENDED

The PRT JES Output:
Code:

SUPERKZ JOB   19327  DDname - PRT       Stepname - STEP0001  Procstep -     
------------------------------------------------------------------------------
...+....10...+....20...+....30...+....40...+....50...+.|..60...+....70...+....
THE DAY OF THE WEEK IS MONDAY    WHICH IS DAY NUMBER  5                       
********************************** End of Data *******************************

The Dataset created:
Code:

 BROWSE    SUPERK.PROG65.OUT                         Line 00000000 Col 001 080
 Command ===>                                                  Scroll ===> CSR 
********************************* Top of Data **********************************
THE DAY OF THE WEEK IS MONDAY    WHICH IS DAY NUMBER  5                         
******************************** Bottom of Data ********************************

The JESYSMSG output:
Code:

IEF142I SUPERKZ STEP0001 - STEP WAS EXECUTED - COND CODE 0005
Back to top
View user's profile Send private message
mrar_160

New User


Joined: 14 Sep 2005
Posts: 48

PostPosted: Mon Feb 13, 2006 8:27 am    Post subject:
Reply with quote

Ok..Thank superk icon_biggrin.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts copying data without knowing location arunsoods DFSORT/ICETOOL 6 Thu Jul 20, 2017 1:03 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 18 Thu Jul 13, 2017 2:11 pm
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us