View previous topic :: View next topic
|
Author |
Message |
trushant.w
New User
Joined: 22 Sep 2013 Posts: 81 Location: pune india
|
|
|
|
Hi All,
In the frist step of my job in am using below sort card to count no of records in input file
Code: |
SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=('NO OF RECORDS: ',COUNT=(M11,LENGTH=8)) |
In second step i want this number of records to be passed to my cobol program via parm parameter.
How to tranasfer this number via parm to cobol i.e what should i write value in Parm
Parm=?? |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
You could dynamically Generate SYSTSIN with PARM |
|
Back to top |
|
|
trushant.w
New User
Joined: 22 Sep 2013 Posts: 81 Location: pune india
|
|
|
|
Thanks for suggestion Pandora-box
If you have idea how to achieve that please share thoughts |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
You cannot do it with PARM. The PARM value is 'frozen' at the time of job submission. You will have to get Syncsort to write the value to SORTOUT and then read that into your program.
Better would be to get the input to the sort to be created with header and trailer as sort has no idea if the number of records in SORTIN is the number that the previous program actually intended to create. |
|
Back to top |
|
|
trushant.w
New User
Joined: 22 Sep 2013 Posts: 81 Location: pune india
|
|
|
|
Quote: |
You will have to get Syncsort to write the value to SORTOUT and then read that into your program |
Yes nic in using sort utility to count no of records.
But how to read that in cobol programe ? |
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
trushant.w wrote: |
Hi All,
In the frist step of my job in am using below sort card to count no of records in input file
Code: |
SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=('NO OF RECORDS: ',COUNT=(M11,LENGTH=8)) |
In second step i want this number of records to be passed to my cobol program via parm parameter.
How to tranasfer this number via parm to cobol i.e what should i write value in Parm
Parm=?? |
There is no simple way to do exactly what you want: PARM text specified in JCL cannot be altered in an earlier step. What you have to do is write the count to a separate data set in step 1, and have the step 2 program read this data set to obtain the count. |
|
Back to top |
|
|
trushant.w
New User
Joined: 22 Sep 2013 Posts: 81 Location: pune india
|
|
|
|
Quote: |
What you have to do is write the count to a separate data set in step 1, and have the step 2 program read this data set to obtain the count. |
Good solution
But his will need to read one more file in my cobol programe i want to avert that.This will be last option avialable if i dont get anything else. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Show the JCL which executes your program, so we can tell if Pandora's suggestion would apply.
What do you want to do with the value anyway? |
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
I'm not sure what Pandora is thinking myself. DD name SYSTSIN is usually associated with running TSO in batch.
Quote: |
Good solution
But his will need to read one more file in my cobol programe i want to avert that.This will be last option avialable if i dont get anything else. |
You have to do what works. I'm not a real Cobol expert; just looking at what other people seem to have done it seems to me writing all the Cobol statements just to read a single record in a data set is painful, but you have to do what works. It can't be much worse than extracting PARM data! |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
steve-myers,
As Bill said we need to wait till TS shows his step which would prove if my solution is possible or not |
|
Back to top |
|
|
trushant.w
New User
Joined: 22 Sep 2013 Posts: 81 Location: pune india
|
|
|
|
Code: |
//SORTIN DD DSN=LFML.EXTW131.PAD.TEST1(DATERG),DISP=SHR
//*
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=('NO OF RECORDS: ',COUNT=(M11,LENGTH=8))
/*
//STP01#02 EXEC REGMVST,MVS=COB707
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//DD1 DD DSN=LFML.EXTW131.PAD.TEST1(AOUTO),DISP=SHR
//DD2 DD DSN=LFML.EXTW131.PAD.TEST1(DATERG),DISP=SHR
//DD3 DD DSN=LFML.EXTW131.PAD.TEST1.OUTPUT,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(10,10),RLSE),
// RECFM=FB,LRECL=80 |
I want to pass count to this cob707 program |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
modify this statement in your sort step
Code: |
//SORTOUT DD SYSOUT=* |
to include a DSN statement and necessary DCB and DISP parms
so as to create a NEW permanent DS or a TEMP DS.
then add a new DD statement to STP01#02
using the same DSN as the modified SORTOUT DD statement (in the SORT STEP)
to be used as input to your COBOL program.
as has been repeated said,
there are certain things in you JOB that you can not modify RUN-TIME. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
An alternative approach, but still requiring a program change is to:
1) Write SORTOUT to output file as dbz and others have suggested, but have the dcb information the same as DD2.
2) Concatenate this file first in the DD2 DD.
3) Modify program COB707 to read the first record and process it as you would if it came in through a parm. No extra files to process.
Not the cleanest approach, but if well documented, it should work. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
What has Steve suggested, I agree with him.
However, why ONLY would you like to pass it through PARM than having many other options to do so? you can add one more step to get the trailer count and create a new PS file and add to it and then use this new PS file to your program as SYSIN.
Apart from this Bill or Skolusu could give some more insight from DFSORT/SYNCSORT perspective.
Also you can refer below link more for SET parameter.
ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Rohit Umarjikar wrote: |
What has Steve suggested, I agree with him.
However, why ONLY would you like to pass it through PARM than having many other options to do so? you can add one more step to get the trailer count and create a new PS file and add to it and then use this new PS file to your program as SYSIN.
Apart from this Bill or Skolusu could give some more insight from DFSORT/SYNCSORT perspective.
Also you can refer below link more for SET parameter.
ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf |
Rohit,
I appreciate your enthusiasm to spread the links of DFSORT, but the question here is about a COBOL program that needs to receive the output from SORT. So Why do you think the SET parameter will work in this case?
As others have pointed out there are a couple of ways to get the desired results.
Please don't drag me into answering questions which don't involve DFSORT. I'm happy to answer questions related to DFSORT and DFSORT's ICETOOL but not others.
Thank you |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Quote: |
In second step i want this number of records to be passed to my cobol program via parm parameter |
.
This looks to me like a good case for using the PARMDD statement instead of PARM. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
Skolusu,
Quote: |
Please don't drag me into answering questions which don't involve DFSORT. I'm happy to answer questions related to DFSORT and DFSORT's ICETOOL but not others. |
Point has been noted..
Quote: |
but the question here is about a COBOL program that needs to receive the output from SORT. So Why do you think the SET parameter will work in this case? |
I was not much sure about the DFSORT tricks as you know it all of them , So I thought to take your opinion to leverage any trciks (if possible) to read the trailer record (count) and dynamically add to the PARM. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Rohit Umarjikar wrote: |
I was not much sure about the DFSORT tricks as you know it all of them , So I thought to take your opinion to leverage any trciks (if possible) to read the trailer record (count) and dynamically add to the PARM. |
Trust me there is NO trick involved but pure common programming sense would give OP what he wants. Already a few suggested writing the count to a file and reading it in the cobol program. Apart from that there is another age old method to get the count without defining the file and reading it. But I would leave that to OP to find out and it is quite simple as 1 statement. |
|
Back to top |
|
|
trushant.w
New User
Joined: 22 Sep 2013 Posts: 81 Location: pune india
|
|
|
|
I appreciate all your suggestions.Thank you !!
I will go with writing count to sortout and reading in cobol programe. |
|
Back to top |
|
|
|