View previous topic :: View next topic
|
Author |
Message |
Gopalakrishnan V
Active User
Joined: 28 Jun 2010 Posts: 102 Location: chennai
|
|
|
|
Hi,
I have a JCL with PARM value as &DATE. we are passing the date dynamically while running the job.
My JCL will look like as below,
Code: |
//STEP01 EXEC PGM=ICETOOL,
// PARM='&DATE'
//INFILE DD DSN=INFILE.R&DATE,DISP=SHR
//OUTFILE DD DSN=OUTFILE.R&DATE,
// DISP=(NEW,CATLG,DELETE),UNIT=DELS,
// SPACE=(CYL,(1,1),RLSE),
// DCB=(BLKSIZE=0,RECFM=FB,BUFNO=20)
//SYSOUT DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLIN DD *
OCCUR FROM(INFILE) LIST(OUTFILE) -
NOHEADER NOCC-
ON(1,03,CH) -
ON(VALCNT,N04)
/*
//CTL2CNTL DD *
OUTREC FIELDS=(7:&DATE)
/*
|
I/p file:
IND
AUS
AUS
IND
USA
PARM=2141120 (YYYMMDD)
Expected output file:
IND 2 2141120
AUS 2 2141120
USA 1 2141120
But I am not getting the date field as below ,
IND 2
AUS 2
USA 1
o/p LAYOUT:
COUNTRY COUNT DATE
I dont know whether it can be achievable in JCL itself without using DFSORT/ICETOOL. Thats what I have posted under JCL Topic. Please suggest some solution for this problem.
Thanks in advance |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Which SORT product do you have? (look at the message prefix in the output from your step).
By what magic did you believe specifying CTL2CNTL would cause that file to be processed?
You would need a USING on your OCCUR/OCCURS operator to do that, except you can't have that anyway.
To get a PARM into SORT control cards, you can't do it that way, so you'd have to do it the correct way.
&DATE is a SORT function anyway.
Also see this.
Your BUILD (FIELDS) would create an output record with six blanks followed by the &DATE, which also isn't what you want.
In short, there are many ways this won't work, so you'll have to do some re-thinking. |
|
Back to top |
|
|
Gopalakrishnan V
Active User
Joined: 28 Jun 2010 Posts: 102 Location: chennai
|
|
|
|
Thank you Bill for your reply.
I am not worrying about the spaces in output file...I need the PARM values in output file along with count logic. Because I will change this JCL with JOB and PROC format. So I will pass the parm in JOB jcl manually while submitting the job. Also I will change the &DATE variable into &RUNDATE since this keyword already used in JCL.
I have read the below post but that is for UNIX with JPn logic with DFSORT. similar kind of requirement.
[url]
stackoverflow.com/questions/21481400/passing-symbol-value-using-dfsort-to-file
[/url]
could you please modify it for DFSORT/JCL. It will be grateful if you share some code snippet to fulfill my requirement. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
The link is indeed for DFSORT, but DFSORT doesn't run on Unix, so it is not for Unix.
The link shows you exactly how to get a PARM value from a JCL Symbol into DFSORT, as do examples here.
I'm not sure how well you read my previous post. You're going to have to forget OCCUR/OCCURS.
Can you show some representative sample input and expected output? |
|
Back to top |
|
|
Gopalakrishnan V
Active User
Joined: 28 Jun 2010 Posts: 102 Location: chennai
|
|
|
|
PARM=2141120 (YYYMMDD)
Input file:
IND
AUS
AUS
IND
USA
Expected output file:
IND 2 2141120
AUS 2 2141120
USA 1 2141120
Country code along with their count and date passed in PARM.
Example: IND occurred two times.
Please let me know if you need more information. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
I'm thinking it would look something like this:
Code: |
// EXPORT SYMLIST=(DATE)
// SET DATE='2141120'
//*
//SORT EXEC PGM=ICETOOL
//SYMNAMES DD *,SYMBOLS=JCLONLY
DAT,C'&DATE'
/*
//INFILE DD *
IND
AUS
AUS
IND
USA
/*
//T1 DD DSN=&&T1,DISP=(,PASS),UNIT=VIO
//OUTFILE DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLIN DD *
COPY FROM(INFILE) TO(T1) USING(CTL1)
OCCUR FROM(T1) LIST(OUTFILE) -
NOHEADER NOCC -
ON(1,3,CH) ON(VALCNT,N02) ON(5,8,CH)
/*
//CTL1CNTL DD *
OUTFIL BUILD=(1,3,X,DAT,80:X)
/*
//*
|
|
|
Back to top |
|
|
Gopalakrishnan V
Active User
Joined: 28 Jun 2010 Posts: 102 Location: chennai
|
|
|
|
Thank you Bill & Kevin
The code which Kevin suggested is working fine and concept behind build statement explained by Bill was very useful. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Both on an up-to-date z/OS, and doing the symbol substitution on instream data :-)
You are reading the file twice. The file is SORTed in the OCCUR/OCCURS. You have shown your sample input as unsorted, so that is OK, but you showed your expected output in the same order as the original file (IND came first). You will not be getting your output like that.
Your number of digits for the count suggest small files, so reading the file twice won't show up too much, perhaps. What about the output order? |
|
Back to top |
|
|
Gopalakrishnan V
Active User
Joined: 28 Jun 2010 Posts: 102 Location: chennai
|
|
|
|
Hi Bill,
Sorry I gave the sample output without sorting. I have my input in sorted order.So I hope the output also will be sorted. But the output column needs to be in the below order,
COUNTRY-NAME COUNT PARM-DATE |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If the output order is the same as the input order, you don't need to SORT.
Have a look at using plain SORT (not ICETOOL) with reporting features REMOVECC and SECTIONS with TRAILER2.
If you're sticking with the instream symbol replacement I hope they toss it out when you try to go to Production. Use the JPn for PARM values in SORT. |
|
Back to top |
|
|
|