|
View previous topic :: View next topic
|
| Author |
Message |
KAUSHIK RANGARAJAN
New User

Joined: 19 Jul 2005 Posts: 22 Location: chennai
|
|
|
|
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  |
|
| Back to top |
|
 |
superk
Global Moderator

Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
| 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 |
|
 |
KAUSHIK RANGARAJAN
New User

Joined: 19 Jul 2005 Posts: 22 Location: chennai
|
|
|
|
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.  |
|
| Back to top |
|
 |
anuradha
Active User

Joined: 06 Jan 2004 Posts: 247 Location: Hyderabad
|
|
|
|
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 |
|
 |
superk
Global Moderator

Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
 |
superk
Global Moderator

Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|