Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Passing value via parm

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Passing value via parm
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

Moderator


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

PostPosted: Thu Apr 03, 2014 12:50 pm    Post subject:
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    Post subject:
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: 1714
Location: UK

PostPosted: Thu Apr 03, 2014 2:20 pm    Post subject: Reply to: Passing value via parm
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    Post subject:
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 User


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

PostPosted: Thu Apr 03, 2014 3:42 pm    Post subject: Re: Passing value via parm
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7226

PostPosted: Thu Apr 03, 2014 4:08 pm    Post subject: Reply to: Passing value via parm
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 User


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

PostPosted: Thu Apr 03, 2014 4:51 pm    Post subject:
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

Moderator


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

PostPosted: Thu Apr 03, 2014 6:03 pm    Post subject:
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    Post subject:
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    Post subject:
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: 645
Location: Pennsylvania

PostPosted: Thu Apr 03, 2014 7:16 pm    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Fri Apr 04, 2014 3:33 am    Post subject:
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://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    Post subject:
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://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

Moderator Team Head


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

PostPosted: Sat Apr 05, 2014 2:42 am    Post subject: Reply to: Passing value via parm
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

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Sat Apr 05, 2014 3:56 am    Post subject:
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    Post subject:
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    Post subject:
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    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 FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
No new posts Using 'parm' to vary SORTOUT record v... Sysaron DFSORT/ICETOOL 13 Wed Sep 07, 2016 9:24 pm
No new posts Passing information through JCL as in... Pia Baruah JCL & VSAM 5 Wed May 25, 2016 2:22 pm
No new posts Copy a particular column based on PAR... brindhamohan DFSORT/ICETOOL 5 Wed May 11, 2016 8:49 am
No new posts Use of Parm in SORT Ambili S DFSORT/ICETOOL 2 Mon May 09, 2016 9:16 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us