IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Passing values to cobol program


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Global Moderator


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

PostPosted: Tue Jul 19, 2005 6:32 pm
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
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
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

Global Moderator


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

PostPosted: Thu Jul 21, 2005 8:23 pm
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

Global Moderator


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

PostPosted: Thu Jul 21, 2005 9:21 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top