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

Passing value via parm


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
trushant.w

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Thu Apr 03, 2014 12:41 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Apr 03, 2014 12:50 pm
Reply with quote

You could dynamically Generate SYSTSIN with PARM
Back to top
View user's profile Send private message
trushant.w

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Thu Apr 03, 2014 1:06 pm
Reply with quote

Thanks for suggestion Pandora-box

If you have idea how to achieve that please share thoughts
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Thu Apr 03, 2014 2:20 pm
Reply with quote

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
View user's profile Send private message
trushant.w

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Thu Apr 03, 2014 3:15 pm
Reply with quote

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
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Thu Apr 03, 2014 3:42 pm
Reply with quote

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
View user's profile Send private message
trushant.w

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Thu Apr 03, 2014 3:50 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Apr 03, 2014 4:08 pm
Reply with quote

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
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Thu Apr 03, 2014 4:51 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Apr 03, 2014 6:03 pm
Reply with quote

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
View user's profile Send private message
trushant.w

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Thu Apr 03, 2014 6:26 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Apr 03, 2014 7:00 pm
Reply with quote

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
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Thu Apr 03, 2014 7:16 pm
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Fri Apr 04, 2014 3:33 am
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Apr 04, 2014 11:58 pm
Reply with quote

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
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Sat Apr 05, 2014 2:42 am
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Sat Apr 05, 2014 3:56 am
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Sat Apr 05, 2014 4:07 am
Reply with quote

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
View user's profile Send private message
trushant.w

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Sat Apr 05, 2014 12:38 pm
Reply with quote

I appreciate all your suggestions.Thank you !!
I will go with writing count to sortout and reading in cobol programe.
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 System add a USER parm when job submi... TSO/ISPF 4
No new posts Passing containers on START command CICS 4
No new posts JCL EXEC PARM data in C Java & MQSeries 2
No new posts Need to specify PARM='POSIX(ON) Java & MQSeries 4
No new posts How to pass the PARM value to my targ... COBOL Programming 8
Search our Forums:

Back to Top