Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Passing values to cobol program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
KAUSHIK RANGARAJAN

New User


Joined: 19 Jul 2005
Posts: 22
Location: chennai

PostPosted: Tue Jul 19, 2005 3:49 pm    Post subject: Passing values to cobol program
Reply with quote

Hi,

I am using COUNT in SORT, is there any possibility to send the value in COUNT to a cobol program using PARM or SYSIN.



Bye icon_smile.gif icon_smile.gif
Back to top
View user's profile Send private message

superk

Moderator Team Head


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

PostPosted: Tue Jul 19, 2005 6:32 pm    Post subject: Re: Passing values to cobol program
Reply with quote

Either way. A lot depends on whether the COBOL program is in the same job or in a different job. Certainly, reading the COUNT information in from either the SYSIN DD (via ACCEPT) or as a dataset (via READ) is easier to implement and is probably logically easier for someone else to follow.
Back to top
View user's profile Send private message
KAUSHIK RANGARAJAN

New User


Joined: 19 Jul 2005
Posts: 22
Location: chennai

PostPosted: Thu Jul 21, 2005 5:04 pm    Post subject: Passing values to cobol program
Reply with quote

Hi superk,
I am a fresher in mainframe. I am learning about Sort in JCL and I learnt that there are two ways to find the number of records,

Method 1:
Using ICETOOL,
(a) COUNT FROM(OFILE1)
This is not working.

(b) COUNT FROM(OFILE1) USING(SEP2)
Here I am once again getting a blank data set as in above case.


Here is the code I have done,is it correct?
//TOOLIN DD *
COUNT FROM(OFILE1) USING(SEP1)
/*
//SEP1CNTL DD *
OUTFIL FNAMES=OFILE1,
INCLUDE=(1,4,CH,EQ,C'DEP1')
/*
//* ofile1 is a data set
By finding COUNT using this technique will be tedious and expensive to use it in COBOL.



Method 2:
Using reports,
OUTFIL FNAMES=OUTFILE,
TRAILER1=(5:COUNT)
Here OUTFILE is declared as
//OUTFILE DD SYSOUT=*
So the count value is displayed in the console which is of no use.
If I put some dataset name it gives the error as OUTFILE is not suitable for report, sorry to put another question here, is there any possibility to generate a report in to a dataset.



These are the 2 methods I have used so far, is there any other method to achieve the Count of records ? let me know.


As you answered, we can send count values using SYSIN DD *, how do you map the value you found to the value to be sent,i.e.,
If you put
//SYSIN DD *
COUNt
/*
It will accept this as string COUNT rather than the COUNT value. I have the same doubt for PARM also, how to do that, is there any possibility of moving values in JCL just like another programming language or any pass by reference method to access the value stored by JCL using address in COBOL.

Bye. icon_rolleyes.gif
Back to top
View user's profile Send private message
anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Thu Jul 21, 2005 6:37 pm    Post subject:
Reply with quote

Hi Kaushik!

Did u try the following ways:
Assuming you need the count of records of "MY.DATASET" file.

Code:
//STEP1  EXEC PGM=ICETOOL                         
//TOOLMSG  DD   SYSOUT=*                           
//DFSMSG   DD   SYSOUT=*                           
//IN       DD   DSN=MY.DATASET,DISP=SHR
//TOOLIN   DD   DATA                               
  COUNT FROM(IN)                                   
/*       


Or even you can place the record count into some dataset too:

Code:
//STEP1 EXEC PGM=SORT                             
//SORTIN   DD   DSN=MY.DATASET,DISP=SHR           
//SYSOUT   DD   SYSOUT=*                             
//SORTOUT  DD  DSN=MY.COUNT.OUTPUT,DISP=(,CATLG,DELETE),...                             
//SYSIN    DD   DATA                                 
  OPTION COPY                                         
  OUTFIL REMOVECC,NODETAIL,                           
    SECTIONS=(1,2,                                   
      TRAILER3=(1:COUNT=(M10,LENGTH=10)))             
/*         
Back to top
View user's profile Send private message
superk

Moderator Team Head


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

PostPosted: Thu Jul 21, 2005 8:23 pm    Post subject: Re: Passing values to cobol program
Reply with quote

Building on Anu's example:
Code:

//STEP1    EXEC PGM=SORT                             
//SORTIN   DD   DSN=MY.DATASET,DISP=SHR           
//SYSOUT   DD   SYSOUT=*                             
//SORTOUT  DD   DSN=&&TEMP,DISP=(,PASS),UNIT=VIO
//SYSIN    DD   *                                 
  OPTION COPY                                         
  OUTFIL REMOVECC,NODETAIL,                           
    SECTIONS=(1,2,                                   
      TRAILER3=(1:COUNT=(M10,LENGTH=10)))             
/* 
//*
//STEP2    EXEC PGM=MYPROG
//SYSOUT   DD   SYSOUT=*
//SYSIN    DD   DSN=&&TEMP,DISP=(OLD,PASS)
//*
Back to top
View user's profile Send private message
superk

Moderator Team Head


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

PostPosted: Thu Jul 21, 2005 9:21 pm    Post subject: Re: Passing values to cobol program
Reply with quote

My idea for passing the count as a PARM:

Code:

//JOB1 JOB (......),CLASS=X,MSGCLASS=X
//*
//STEP1    EXEC PGM=SORT                             
//SORTIN   DD   DSN=MY.DATASET,DISP=SHR           
//SYSOUT   DD   SYSOUT=*                             
//SORTOUT  DD   DSN=MY.PARMLIB(COUNT),DISP=SHR
//SYSIN    DD   *                                 
  OPTION COPY                                   
  OUTFIL TRAILER1=(1:C'// SET COUNT=',           
    COUNT=(EDIT=(TTTTTTTTTT))),NODETAIL,REMOVECC,
    OUTREC=(1:1,80)   
/* 
//*

//JOB2 JOB (......),CLASS=X,MSGCLASS=X
//*
// JCLLIB ORDER=MY.PARMLIB
// INCLUDE MEMBER=COUNT
//*
//STEP1 EXEC PGM=MYPROG,PARM='&COUNT'
//...
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts Accessing CICS tran with map from JCL... navdeepaggarwal CICS 5 Tue Oct 03, 2017 6:15 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us